You are here: Foswiki>Tasks Web>Item12893 (05 Jul 2015, GeorgeClark)Edit Attach

Item12893: Nested DEFAULT default Macro parameter expansion

pencil
Priority: Normal
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component:
Branches: trunk
Reported By: JohnHart
Waiting For:
Last Change By: GeorgeClark

CASE 1

  • Set Test = "%arg{default="%DEFAULT{default="Y"}%"}%"

%Test%%BR%
%Test{"X"}%%BR%
%Test{arg="X"}%%BR%

What I would expect:

"Y"
"X"
"X"

What I'm getting:

"Y"
"X"
"Y"

My guess is that the default from the fragment:

%DEFAULT{default="Y"

is being picked up and used to satisfy the:

%arg{default=

-- JohnHart - 08 May 2014

You were almost right, but it was a little bit more complicated than that. What was happening was the code that is supposed to handle the inner expansion of a preference was not handling the default= parameter to the DEFAULT tag correctly, and it would not handle this corner case correctly. I fixed it in the 1.2.0 codebase.

Glad that someone is pushing this code; it's the only way we find this sort of problem.

-- CrawfordCurrie - 09 May 2014

Very cool - thanks - my first tiny contribution - BTW {I neglected to mention this in my orginal post) inverting the nesting produces a variation of this behavior (my suspicion is that the fix you've already made covers this alternate case)

CASE 2

  • Set Test = "%DEFAULT{default="%arg{default="Y"}%"}%"

%Test%%BR%
%Test{"X"}%%BR%
%Test{arg="X"}%%BR%

What I would expect:

"Y"
"X"
"X"

What I'm getting:

"Y"
"Y"
"X"

-- JohnHart - 09 May 2014
 

ItemTemplate edit

Summary Nested DEFAULT default Macro parameter expansion
ReportedBy JohnHart
Codebase 1.1.9, trunk
SVN Range
AppliesTo Engine
Component
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:b11aa5f7dba2
TargetRelease major
ReleasedIn 2.0.0
CheckinsOnBranches trunk
trunkCheckins distro:b11aa5f7dba2
Release01x01Checkins
Topic revision: r6 - 05 Jul 2015, GeorgeClark - This page was cached on 27 Jul 2016 - 03:18.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License