Tags:
create new tag
view all tags

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

TWiki version: TWikiRelease04Sep2004
TWiki plugins: DefaultPlugin, SpreadSheetPlugin, ActionTrackerPlugin, CommentPlugin, ConditionalPlugin, EditTablePlugin, InterwikiPlugin, RedirectPlugin, RenderListPlugin, SlideShowPlugin, SmiliesPlugin, TablePlugin
Server OS: Fedora Core 2
Web server: apache 2.0.51
Perl version: perl 5.8.3
Client OS: windows XP
Web Browser: firefox
Categories: Plugins

-- JohnRouillard - 16 Mar 2006

Answer

ALERT! 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

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2006-03-28 - CrawfordCurrie
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.