You are here: Foswiki>Tasks Web>Item11519 (21 Dec 2014, GeorgeClark)Edit Attach

Item11519: "extra" parameters for INCLUDEs don't expand consistently

pencil
Priority: Enhancement
Current State: Confirmed
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: INCLUDE
Branches:
Reported By: RichMorin
Waiting For:
Last Change By: GeorgeClark
It's possible to use "extra" parameters to perform simple macro substitution inside the body of an INCLUDE, eg:

# Definition:

%STARTSECTION{"sec_1"}%
The value of foo is %foo%.
%ENDSECTION%

# Invocation:

%INCLUDE{... section="sec_1" foo="42"}%

# Resulting HTML

The value of foo is 42.

However, the expansion does not work properly when the variable is used within a pre or verbatim tag, eg:

# Definition:

%STARTSECTION{"sec_2"}%
The value of foo is %foo%.
<pre id="%foo%">
...
</pre>
%ENDSECTION%

# Invocation:

%INCLUDE{... section="sec_2" foo="42"}%

# Resulting HTML

The value of foo is 42.
<pre id="%foo%>
...
</pre>

In this case, the id value defined in the generated HTML will be %foo%.

FWIW, there's a really hacky workaround:

# Definition:

%STARTSECTION{"sec_3"}%
The value of foo is %foo%.
<%pre% id="%foo%">
...
</%pre%>
%ENDSECTION%

# Invocation:

%INCLUDE{... section="sec_3" foo="42" pre="pre"}%

# Resulting HTML

The value of foo is 42.
<pre id="42">
...
</pre>

-- RichMorin - 12 Feb 2012

 

i think that its because takeOutBlocks removes the enclosing verbatim and pre sections. Rich's use makes sense to me, and it'd be useful to fix this so that we takeOut the text inside the block, and then deal with the verbatim non-tag conversion to real html when we put the text back in.

-- SvenDowideit - 12 Feb 2012

ItemTemplate edit

Summary "extra" parameters for INCLUDEs don't expand consistently
ReportedBy RichMorin
Codebase
SVN Range
AppliesTo Engine
Component INCLUDE
Priority Enhancement
CurrentState Confirmed
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release01x01Checkins
Topic revision: r4 - 21 Dec 2014, GeorgeClark
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