PreRenderingHandler
Handler called immediately before TWiki syntax structures (such as lists) are
processed, but after all variables have been expanded. Use this handler to
process special syntax only recognised by your plugin.
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 <!--!marker!--> characters so the
text will contain <!--!pre1!--> 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:
<pre>
$removed->{'pre1'}{text}: XYZ
$removed->{'pre1'}{params}: class="slobadob"
</pre>
Iterating over blocks for a single tag is easy. For example, to prepend a
line number to every line of every pre block you might use this code:
<verbatim>
foreach my $placeholder ( keys %$map ) {
if( $placeholder =~ /^pre/i ) {
my $n = 1;
$map->{$placeholder}{text} =~ s/^/$n++/gem;
}
}
</verbatim>
__NOTE__: This handler is called once for each rendered block of text i.e.
it may be called several times during the rendering of a topic.
__NOTE:__ meta-data is _not_ embedded in the text passed to this
handler.
Since TWiki::Plugins::VERSION = '1.026'