Question
I am using the
CommentPlugin version 3.003. I am using the customization capability of the
comment plugin. I have created a comment template called "rfo". In the output section I have:
%TMPL:DEF{OUTPUT:rfo}%%POS:TOP%
---+!! %URLPARAM{"summary"}% RT:%URLPARAM{"rt"}%
Back to %URLPARAM{"parenttopic"}%.
%TOC%
In the page I want to have the literal %TOC% to display a dynamic
table of contents. However the %TOC% is being replaced by the html code that implements the
table of contents.
I need to find some way of escaping the %TOC% in the twiki UserTemplates
output section. I have tried:
%NOP%%TOC%
%TOC%NOP%%
%%NOP%TOC%
%%NOP{}%TOC%
%URLPARAM{"percent"}%TOC% # where the percent parameter's value is %
and ended up with the literal %<nop>TOC% which doesn't display the table of contents, or the
html code for the table of contents, which looks right but doesn't update when new sections are added
to the page. Does anybody have any ideas on how I can embed a literal TWiki variable in the comment
template that will show up as a working twiki variable when the comment is displayed.
Thanks for your help.
-- rouilj
Environment
--
JohnRouillard - 16 Mar 2006
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
This is a known problem, that was fixed quite some time ago. I can't recall if I fixed it for 20040904 or not. The problem is that the only way to expand a template in that release also involves expanding all the tags in the template. Unfortunately the last tag to be expanded is always %TOC, so blocking the expansion is nigh-on impossible.
I can suggest a workaround, which is to use %PROTECTEDTOC% into the rfo output template, and then modify lib/TWiki/Plugins/CommentPlugin/Comment.pm as follows: find
my $t =
TWiki::Func::expandCommonVariables( "%TMPL:P{$name}%", $topic, $web );
Immediately after it add:
$t =~ s/%PROTECTEDTOC%/%TOC%/g;
That ought to work.
--
CrawfordCurrie - 28 Mar 2006