Tags:
create new tag
, view all tags

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

Topic revision: r3 - 2004-04-28 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.