r3 - 28 Apr 2004 - 06:40:44 - PeterThoenyYou are here: TWiki >  Codev Web > PreviewExpandsVariablesTwice
Tags:
, create new tag

Bug: Preview Expands Variables Twice

The PreviewCgiScript expands variables twice, but ViewCgiScript only once, as reported in VariableExpandsInPreviewButNotInNormalView.

Test case

Write:

  %CALC{AAA $NOP(%)CALC{BBB}$NOP(%) ZZZ}%

Preview renders as:

  AAA BBB ZZZ

View renders as:

  AAA %CALC{BBB}% ZZZ

Test:
AAA %CALC{BBB}% ZZZ

The nested CALC should not get resolved in preview.

Environment

TWiki version: TWikiRelease01Feb2003
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin, SpreadSheetPlugin, others
Server OS: N/A
Web server: N/A
Perl version: N/A
Client OS: N/A
Web Browser: N/A

-- PeterThoeny - 06 Mar 2004

Follow up

This needs to be aligned with view, which also improves the performance in preview.

Fix record

Removed extra TWiki::handleCommonTags( ) call in preview script.

Change in TWikiAlphaRelease and TWiki.org:

*** bu4/preview 2003-11-23 20:22:25.000000000 -0800
--- preview     2004-03-09 11:23:00.000000000 -0800
***************
*** 150,160 ****

      # do not allow click on link before save: (mods by TedPavlic)
      my $oopsUrl = '%SCRIPTURLPATH%/oops%SCRIPTSUFFIX%/%WEB%/%TOPIC%';
      $ptext =~ s@(?<=<a\s)([^>]*)(href=(?:".*?"|[^"].*?(?=[\s>])))@$1href="$oopsUrl?template=oopspreview"@goi;
      $ptext =~ s@<form(?:|\s.*?)>@<form action="$oopsUrl">\n<input type="hidden" name="template" value="oopspreview">@goi;
      $ptext =~ s@(?<=<)([^\s]+?[^>]*)(onclick=(?:"location.href='.*?'"|location.href='[^']*?'(?=[\s>])))@$1onclick="location.href='$oopsUrl\?
template=oopspreview'"@goi;

-     $ptext = &TWiki::handleCommonTags( $ptext, $topic );
      $ptext = &TWiki::putBackVerbatim( $ptext, "pre", @verbatim );

      $tmpl = &TWiki::handleCommonTags( $tmpl, $topic );
--- 150,160 ----

      # do not allow click on link before save: (mods by TedPavlic)
      my $oopsUrl = '%SCRIPTURLPATH%/oops%SCRIPTSUFFIX%/%WEB%/%TOPIC%';
+     $oopsUrl = &TWiki::handleCommonTags( $oopsUrl, $topic );
      $ptext =~ s@(?<=<a\s)([^>]*)(href=(?:".*?"|[^"].*?(?=[\s>])))@$1href="$oopsUrl?template=oopspreview"@goi;
      $ptext =~ s@<form(?:|\s.*?)>@<form action="$oopsUrl">\n<input type="hidden" name="template" value="oopspreview">@goi;
      $ptext =~ s@(?<=<)([^\s]+?[^>]*)(onclick=(?:"location.href='.*?'"|location.href='[^']*?'(?=[\s>])))@$1onclick="location.href='$oopsUrl\?
template=oopspreview'"@goi;

      $ptext = &TWiki::putBackVerbatim( $ptext, "pre", @verbatim );

      $tmpl = &TWiki::handleCommonTags( $tmpl, $topic );

-- PeterThoeny - 06 Mar 2004

Fixed issue of oops links with unresolved variables. Fix is in TWikiAlphaRelease and at TWiki.org.

-- PeterThoeny - 09 Mar 2004

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r3 < r2 < r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo