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

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads