• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item3601: %ICON% doesn't parse properly with %IFDEFINED%

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension IfDefinedPlugin Normal No Action Required   n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

I'm not entirely sure if I filed it correctly. Detail descriptions can be found here.

Basically, the following...

%IFDEFINED{ "Main.SomeGroup" glue="off" then="   * %ICON{wrench}% [[WebPreferences][Settings]]"}

Will produce

<img width=

Another:

%IFDEFINEDTHEN { "Main.SomeGroup" glue="off" }%
   * %ICON{wrench}% [[WebPreferences][Settings]]
%FIDEFINED%

%IFDEFINEDTHEN% is not parsed

Problem is with single and double quotations.

-- TWiki:Main/KwangErnLiew - 10 Feb 2007

Yes. The first example does not render, because %ICON% is expanded before %IFDEFINED% leaving behind something like this

%IFDEFINED{ "Main.SomeGroup" glue="off" then="   * <img width="16px" src="..." ... /> [[WebPreferences][Settings]]"}

As you can see, this will break parsing the arguments for %IFDEFINED% as the then argument is "   * img width=" . So this is a limitation if TWiki's parser which processes strings left-to-right-inside-out. That is, arguments to a tag are parsed before the tag itself, thus kind of passing by value.

Solution, use this:

%IFDEFINED{ "Main.SomeGroup" glue="off" then="   * $percntICON{wrench}$percnt [[WebPreferences][Settings]]"}

The second example does not parse properly because there's a spurious space:

%IFDEFINEDTHENspace{ "Main.SomeGroup" glue="off" }%
   * %ICON{wrench}% [[WebPreferences][Settings]]
%FIDEFINED%

-- MichaelDaum - 10 Feb 2007

See also the workaround I described at TWiki:Support/AuthenticateWebLinksWithIcons

-- TWiki:Main.PeterThoeny - 10 Feb 2007

The problem of quotes in the variable value occurs with %IF% and %INCLUDE%.

-- TWiki:Main.ArthurClemens - 10 Feb 2007

ItemTemplate
Summary %ICON% doesn't parse properly with %IFDEFINED%
ReportedBy TWiki:Main.KwangErnLiew
Codebase 4.0.5
SVN Range TWiki-4.1.1, Fri, 09 Feb 2007, build 12817
AppliesTo Extension
Component IfDefinedPlugin
Priority Normal
CurrentState No Action Required
WaitingFor

Checkins

TargetRelease n/a
ReleasedIn

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2007-02-10 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback