See test page
IncludeVarInIncludeSectionTest: the variable
TOPICNAME
is passed to the included section (or topic) but not recognized by the
IF
statement.
AC
No, that's not true. You are (understandably) confused about the evaluation order.
When a topic is included, the content of that topic is placed in-line into the including topic. Any INCLUDE parameters are expanded at that time, so the text embedded in the including topic will have %TOPICNAME% expanded. However %IF statements are
not expanded. So your
%IF{"defined TOPICNAME
is evaluated in the context of the
including topic, where
%TOPICNAME
is
not defined.
You can either define TOPICNAME in the
including topic
<!--
* Set TOPICNAME =
-->
or you can test the expanded variable name in the
included topic
%IF{"'%TOPICNAME%'!=''" then="defined" else="not defined"}%
in the included topic.
Discarded.
CC
I have updated the test but cannot get
%TOPICNAME%
evaluate to empty string.
AC
I've solved my problem in a slightly different way by passing a ('boolean') value
PREFILLTOPIC='1'
to the included section. This is easier to test.
Nevertheless it would be nice if a solution to this Bug could be added to
IncludeTopicsAndWebPages.
AC
It is not a bug -
IF defined
works the way it is documented. Discarding.
CC