Tags:
create new tag
, view all tags

Question

Rendering issues seen when nested quotes are used with the IF variable. I know this seems like the most "newbie" of questions, but I cannot locate the desired info. What's the correct format for nested quotes when using IF?

I've created a IfRenderingIssue topic which incorporates nested quotes. I know that the usage of single and double quotes addresses the specific example. But what about more complex situations? The VarIF help doesn't contain nested quotes information while VarENCODE and VarURLPARAM at least mention it (but the examples don't actually have any escaped quotes as far as I can tell).

The rendering of IF doesn't seem to support escaped quotes or at least seems to have no impact. Is this something that should be supported? In addition, I'm wondering if this issu is related to WebLeftBarIncludeIssue since similar HTML gets generated.

<img width=
Thanks, dB...

Environment

TWiki version: TWikiRelease04x01x01
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: twiki.org
Web server: twiki.org
Perl version:  
Client OS: Windows 2000
Web Browser: Firefox 2.0.0.5
Categories: Missing functionality

-- DonBowden - 27 Jul 2007

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.

TWiki evaluates TWiki variables inside-out and left-right, so if you say %IF{"%X%" then %X% will be evaluated before %IF. There is no way to change this evaluation order (there can't be, because of the way TWiki variables work frown ). So if %X expands to some text that contains quotes, it will break the parse of the "outer" %IF.

My usual approach to your specific problem is to use %NOP. Say, for example, you want search performed only if some condition evaluates to true. Write:

%%IF{"condition" then="SEARCH" else="NOP"}%{"search term"...}%

The %IF is evaluated first. If "condition" evaluates to true, the text expands to

%SEARCH{"search term"...}%

If it evaluates to false, then the text expands to

%NOP{"search term"...}%

which in turn expands to the empty string.

-- CrawfordCurrie - 01 Sep 2007

Change status to:
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2007-09-01 - 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-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.