Item12125: single quote ICON impl shows up IF single quote usage

pencil
Priority: Urgent
Current State: Closed
Released In: 1.2.0
Target Release: minor
Applies To: Engine
Component:
Branches:
Reported By: SvenDowideit
Waiting For:
Last Change By: CrawfordCurrie
I didn't know that you could mix single and double quotes in a macro:


%IF{"defined search" then='<a href="#" style="text-decoration:none;" onclick="location.hash=\'twikiSearchForm\'; return false;">%ICON{down}% <span class="patternLinkLabel">%MAKETEXT{Modify search}%</span></a>'}%

from WebSearch was obviously coded carefully to deal with ICON's double quoteyness, have to wirk out if we can mitigate its affects :/

-- SvenDowideit - 07 Oct 2012

I may back this out from 1.2.0, as its one more pain point and I have too many already.

-- SvenDowideit - 07 Nov 2012

ICON is a bit of a bugger; but it demonstrates the need for some sort of literalness that can carry right through to the output. I quickly hacked in 'pseudo-entities' like this:

  1. In ICON.pm, return a fake entity '&iconN;' where N is a number of an entry in a cache.
  2. In Foswiki.pm, immediately before the completePageHandler is dispatched, substitute these fake entities with the real thing.

Of course this may have a downside; plugins will no longer see the HTML generated for icons. But I think that's a small price to pay for such a simple solution to an old problem.

A proper solution would allow registering pseudo-entity types for other "last-minute" substitutions (though I would not favour exposing this capability to plugins).

Comments please.

-- CrawfordCurrie - 26 Mar 2013

Crawford, I think your patch is a bad idea as it is right now, because

  1. it tries to solve two rather small but poorly written wiki apps shipped with foswiki
  2. the rendering process is already complicated enough. adding a special treatment for %ICON only is totally off. best is to stick to the evaluation order and make your wiki apps cope with it as usual.
  3. I'd strongly recommend to every wiki app writer to reserve single quotes for HTML attributes only and always use double quotes in macros.

In any case this needs a feature request to nail down the specs properly in case we agree to do the feature at all.

The general idea of caching objects in memory and reference them later is a good one, especially when implementing list operations properly. But delaying expansion of some very specific macros thus taking them out of the inside-out-left-to-right order is another thing. And once the wiki apps triggering this bug item are fixed to adhere to this rule, there's no need for your patch anymore.

-- MichaelDaum - 26 Mar 2013

See SuperLiteralForMacros for proposal.

-- CrawfordCurrie - 26 Mar 2013

I jumped the gun and resolved this with a quote parameter to the ICON macro. See Item12326 for checkin details.

-- CrawfordCurrie - 24 Oct 2013

 

ItemTemplate edit

Summary single quote ICON impl shows up IF single quote usage
ReportedBy SvenDowideit
Codebase trunk
SVN Range
AppliesTo Engine
Component
Priority Urgent
CurrentState Closed
WaitingFor
Checkins
TargetRelease minor
ReleasedIn 1.2.0
CheckinsOnBranches
trunkCheckins
Release01x01Checkins
Topic revision: r9 - 24 Oct 2013, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy