Hypothesis

this is UseOfLocalInsideIncludedSections but with the sections defined outside of the topic they're used

  • before INCLUDELOCAL1 globally is %LOCAL1%
%INCLUDE{"UseOfLocalInsideIncludedSections" section="memepickme" PARONE="PASS"}% expands to:

memepickme(PASS)
  • Local LOCAL1 = PASS
LOCAL1 is %LOCAL1%

  • after INCLUDE LOCAL1 globally is %LOCAL1%

I was frankly surprised by this; I didn't think something like this should work, so I started researching why it does (appear to) work.

Findings

The first time I tried to do this I tried it without the <verbatim> block around the SECTION. It didn't work, the verbatim is required.

Finding 1: Any SECTION used this way must be wrapped in verbatim tags.

The second thing I tried was to establish if this really is defining a local variable. The obvious way to test this is to do it twice:
  • before INCLUDE LOCAL globally is %LOCAL%
%INCLUDE{"UseOfLocalInsideIncludedSections" section="memepickme2" PARONE="ONE" PARTWO="TWO"}% expands to

memepickme(ONE,TWO)
  • Local LOCAL = ONE
LOCAL is %LOCAL%

  • after first INCLUDE LOCAL globally is %LOCAL%

%INCLUDE{"UseOfLocalInsideIncludedSections" section="ohnonotagain" PARONE="THREE" PARTWO="FOUR"}% expands to

ohnonotagain(THREE,FOUR)
  • Local LOCAL = FOUR
LOCAL is %LOCAL%

  • after secondINCLUDE LOCAL globally is %LOCAL%

So it's clearly not a local variable, in the sense of a setting that is local to a section definition. In fact it looks as if it depends on the * Set being evaluated when the topic is read (unsurprising I guess) so the second * Set always wins.

So the second caveat is:

Finding 2: you can't use the same preference name in two SECTIONs in the same topic.

That rather suggests that the * Set doesn't have to be inside the SECTION; so the next thing I tried was:

%INCLUDE{"UseOfLocalInsideIncludedSections" section="itwisnaeme" PARONE="PASS"}% expands to memepickme(PASS) => NOTREALLYLOCAL is %NOTREALLYLOCAL%

That works so long as the SECTION is in the same topic as the INCLUDE (the topic include itself) but fails if the SECTION is included from another topic (the typical case)

Finding 3: the * Set must be within the SECTION for generality.

Please feel free to add comments / more findings

-- CrawfordCurrie - 18 Apr 2012

adding more weird ideas - sadly this will require many topics to explore - and then we should make them all into unit tests

-- SvenDowideit - 18 Apr 2012
Topic revision: r1 - 18 Apr 2012, SvenDowideit
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