< < |
Called by the register script
ObjectMethod *beforeCommonTagsHandler ()
Called at the beginning (for cache Plugins only)
Called after %INCLUDE:"..."%
ObjectMethod *afterCommonTagsHandler ()
Called at the end (for cache Plugins only)
ObjectMethod *preRenderingHandler ($text,\%map)
-
$text - the text, with the head, verbatim and pre blocks replaced with placeholders
-
\%removed - reference to a hash that maps the placeholders to the removed blocks.
Placeholders are text strings constructed using the tag name and a sequence number e.g. 'pre1', "verbatim6", "head1" etc. Placeholders are inserted into the text inside \1 characters so the text will contain \1_pre1\1 for placeholder pre1.
Each removed block is represented by the block text and the parameters passed to the tag (usually empty) e.g. for
<pre class='slobadob'>
XYZ
</pre>
the map will contain:
$removed->{'pre1'}{text}: XYZ
$removed->{'pre1'}{params}: class="slobadob"
Iterating over blocks for a single tag is easy. For example, to prepend a line number to every line of a pre block you might use this code:
foreach my $placeholder ( keys %$map ) {
if( $placeholder =~ /^pre/i ) {
my $n = 1;
$map->{$placeholder}{text} =~ s/^/$n++/gem;
}
}
ObjectMethod *postRenderingHandler (\$text)
-
\$text - a reference to the HTML, with the head, verbatim and pre blocks replaced with placeholders
ObjectMethod *startRenderingHandler ()
Called just before the line loop
DEPRECATED Use preRenderingHandler instead. This handler correctly
handles verbatim and other TWiki ML block types, and exposes them to
the plugin.
Called in line loop outside of <PRE> tag
DEPRECATED Use preRenderingHandler instead.
This handler correctly handles pre and other
TWiki ML block types, and is called only once
instead of line-by-line.
Called in line loop inside of <PRE> tag
DEPRECATED Use preRenderingHandler instead.
This handler correctly handles pre and other
TWiki ML block types, and is called only once
instead of line-by-line.
Called just after the line loop
DEPRECATED Use postRenderingHandler instead.
Called by edit
Called by edit
Called just before the save action
Called just after the save action
ObjectMethod *afterRenameHandler ($oldWeb,$oldTopic,$oldAttachment,$newWeb,$newTopic,$newAttachment)
Called just after the rename/move/delete action of a web, topic or attachment.
-
$oldWeb - name of old web
-
$oldTopic - name of old topic (empty string if web rename)
-
$oldAttachment - name of old attachment (empty string if web or topic rename)
-
$newWeb - name of new web
-
$newTopic - name of new topic (empty string if web rename)
-
$newAttachment - name of new attachment (empty string if web or topic rename)
Called to handle text merge.
ObjectMethod *beforeAttachmentSaveHandler ($attrHashRef,$topic,$web)
This code provides Plugins with the opportunity to alter an uploaded attachment between the upload and save-to-store processes. It is invoked as per other Plugins.
-
$attrHashRef - Hash reference of attachment attributes (keys are indicated below)
-
$topic - Topic name
-
$web - Web name
Keys in $attrHashRef:
Key |
Value |
attachment |
Name of the attachment |
tmpFilename |
Name of the local file that stores the upload |
comment |
Comment to be associated with the upload |
user |
Login name of the person submitting the attachment, e.g. 'jsmith' |
Note: All keys should be used read-only, except for comment which can be modified.
Example usage:
my( $attrHashRef, $topic, $web ) = @_;
$$attrHashRef{'comment'} .= " (NOTE: Extracted from blah.tar.gz)";
ObjectMethod *afterAttachmentSaveHandler ($attachmentAttrHash,$topic,$web,$error)
deal with an uploaded attachment between the upload and save-to-store processes. It is invoked as per other plugins.
-
$attrHashRef - Hash reference of attachment attributes (keys are indicated below)
-
$topic - Topic name
-
$web - Web name
-
$error - Error string of save action, empty if OK
Keys in $attrHashRef:
Key |
Value<-- --> |
comment |
Comment to be associated with the upload |
user |
Login name of the person submitting the attachment, e.g. 'jsmith' |
attachment |
Name of the attachment |
tmpFilename |
Name of the local file that stores the upload |
Note: The hash is read-only
ObjectMethod *writeHeaderHandler () -> $headers
DEPRECATED Use modifyHeaderHandler instead. it is a lot
more flexible, and allows you to modify existing headers
as well as add new ones. It also works correctly when
multiple plugins want to modify headers.
ObjectMethod *modifyHeaderHandler (\@headers,$query)
ObjectMethod *completePageHandler ($text,$pageType,$contentType)
ObjectMethod *redirectCgiQueryHandler () -> $result
Called by TWiki::redirect
ObjectMethod *renderFormFieldForEditHandler ($name,$type,$size,$value,$attributes,$possibleValues) -> $html
This handler is called before built-in types are considered. It generates the HTML text rendering this form field, or false, if the rendering should be done by the built-in type handlers.
-
$name - name of form field
-
$type - type of form field
-
$size - size of form field
-
$value - value held in the form field
-
$attributes - attributes of form field
-
$possibleValues - the values defined as options for form field, if any. May be a scalar (one legal value) or an array (several legal values)
Return HTML text that renders this field. If false, form rendering continues by considering the built-in types.
Note that a common application would be to generate formatting of the
field involving generation of javascript. Such usually also requires
the insertion of some common javascript into the page header. Unfortunately,
there is currently no mechanism to pass that script to where the header of
the page is visible. Consequentially, the common javascript may have to
be emitted as part of the field formatting and might be duplicated many
times throughout the page.
ObjectMethod *renderWikiWordHandler () -> $result
Change how a WikiWord is rendered
Originated from the TWiki:Plugins.SpacedWikiWordPlugin hack |