Difference: TWikiRenderDotPm (4 vs. 5)

Revision 52008-01-22 - TWikiContributor

Line: 7 to 7
 

ClassMethod new ($session)

Changed:
<
<
Creates a new renderer with initial state from preference values (NEWTOPICBGCOLOR, NEWTOPICFONTCOLOR NEWTOPICLINKSYMBOL LINKTOOLTIPINFO)
>
>
Creates a new renderer

ObjectMethod finish ()

Break circular references.
 
Line: 25 to 28
 
Deleted:
<
<

ObjectMethod renderFormField ($web,$topic,$meta,$params) -> $text

Render meta-data for a single formfield

 

ObjectMethod makeAnchorName ($anchorName,$compatibilityMode) -> $anchorName

Changed:
<
<
  • $anchorName -
  • $compatibilityMode -
>
>
  • $anchorName - the unprocessed anchor name
  • $compatibilityMode - SMELL: compatibility with what?? Who knows. frown
  Build a valid HTML anchor name

Changed:
<
<

ObjectMethod internalLink ($theWeb,$theTopic,$theLinkText,$theAnchor,$doLink,$doKeepWeb) -> $html

>
>

ObjectMethod internalLink ($theWeb,$theTopic,$theLinkText,$theAnchor,$doLink,$doKeepWeb,$hasExplicitLinkLabel) -> $html

  Generate a link.

Note: Topic names may be spaced out. Spaced out names are converted to WikWords, for example, "spaced topic name" points to "SpacedTopicName".

  • $theWeb - the web containing the topic
Changed:
<
<
  • $theTopic - the topic to be lunk
>
>
  • $theTopic - the topic to be link
 
  • $theLinkText - text to use for the link
  • $theAnchor - the link anchor, if any
  • $doLinkToMissingPages - boolean: false means suppress link for non-existing pages
  • $doKeepWeb - boolean: true to keep web prefix (for non existing Web.TOPIC)
Added:
>
>
  Called by _handleWikiWord and _handleSquareBracketedLink and by Func::internalLink
Line: 113 to 111
 
Deleted:
<
<

ObjectMethod takeOutProtected (\$text,$re,\%map) -> $text

  • $text - Text to process
  • $re - Regular expression that matches tag expressions to remove
  • \%map - Reference to a hash to contain the removed blocks

Return value: $text with blocks removed

used to extract from $text comment type tags like <!DOCTYPE blah>

WARNING: if you want to take out <!-- comments --> you will need to re-write all the takeOuts to use a different placeholder

ObjectMethod putBackProtected (\$text,\%map,$callback) -> $text

Return value: $text with blocks added back

  • \$text - reference to text to process
  • \%map - map placeholders to blocks removed by takeOutBlocks
  • $callback - Reference to function to call on each block being inserted (optional)

Reverses the actions of takeOutProtected.

 

ObjectMethod takeOutBlocks (\$text,$tag,\%map) -> $text

  • $text - Text to process
Line: 234 to 206
 \%options may contain:
  • pre => true, will call fn for each line in pre blocks
  • verbatim => true, will call fn for each line in verbatim blocks
Added:
>
>
  • literal => true, will call fn for each line in literal blocks
 
  • noautolink > true, will call fn for each line in =noautolink blocks
Changed:
<
<
The spec of \&fn is sub fn( \$line, \%options ) -> $newLine; the %options hash passed into this function is passed down to the sub, and the keys in_pre, in_verbatim and in_noautolink are set boolean TRUE if the line is from one (or more) of those block types.
>
>
The spec of \&fn is sub fn( $line, \%options ) -> $newLine. The %options hash passed into this function is passed down to the sub, and the keys in_literal, in_pre, in_verbatim and in_noautolink are set boolean TRUE if the line is from one (or more) of those block types.
  The return result replaces $line in $newText.

Added:
>
>

StaticMethod getReferenceRE ($web,$topic,%options) -> $re

  • $web, $topic - specify the topic being referred to, or web if $topic is undef.
  • %options - the following options are available
    • interweb - if true, then fully web-qualified references are required.
    • grep - if true, generate a GNU-grep compatible RE instead of the default Perl RE.
    • url - if set, generates an expression that will match a TWiki URL that points to the web/topic, instead of the default which matches topic links in plain text.
Generate a regular expression that can be used to match references to the specified web/topic. Note that the resultant RE will only match fully qualified (i.e. with web specifier) topic names and topic names that are wikiwords in text. Works for spaced-out wikiwords for topic names.

The RE returned is designed to be used with s///

 

StaticMethod replaceTopicReferences ($text,\%options) -> $text

Callback designed for use with forEachLine, to replace topic references. \%options contains:

  • oldWeb => Web of reference to replace
  • oldTopic => Topic of reference to replace
Deleted:
<
<
  • spacedTopic => RE matching spaced out oldTopic
 
  • newWeb => Web of new reference
  • newTopic => Topic of new reference
  • inWeb => the web which the text we are presently processing resides in
Line: 275 to 270
 
Deleted:
<
<

StaticMethod renderFormFieldArg ($meta,$args) -> $text

Parse the arguments to a $formfield specification and extract the relevant formfield from the given meta data.

  • args string containing name of form field

In addition to the name of a field args can be appended with a commas followed by a string format (\d+)([,\s*]\.\.\.)?). This supports the formatted search function $formfield and is used to shorten the returned string or a hyphenated string.

 

StaticMethod breakName ($text,$args) -> $text

  • $text - text to "break"
Line: 301 to 282
 as it is a rendering function_
Added:
>
>

StaticMethod protectFormFieldValue ($value,$attrs) -> $html

Given the value of a form field, and a set of attributes that control how to display that value, protect the value from further processing.

The protected value is determined from the value of the field after:

  • newlines are replaced with <br> or the value of $attrs->{newline}
  • processing through breakName if $attrs->{break} is defined
  • escaping of $vars if $attrs->{protectdollar} is defined
  • | is replaced with &#124; or the value of $attrs->{bar} if defined
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiRenderDotPm.