Stephen Betts wrote:
<myFirstExt>{{{1}}}</myFirstExt>
but the problem is that I get the string '{{{1}}}' passed in to the
extension, rather that the value entered in the template call,
'argument1' in the exampel.
Sooo, my question is as follows: is there any way to get the value of
the argument into the extension?
You might be able to call back into the parser to get it, but I'm not
really sure. Extensions are taken out as one of the first stages of wiki
processing, then their HTML output is inserted as one of the later stages.
To give a little bit of background, basically I want
to define a few
extensions, but, to get the formatting that I want, each extension
needs to be aware of what extensions have already been used.
Parser hook extensions are assumed to follow these rules:
1) An extension should always return the same output for the same input.
2) The input consists entirely of the text inside the tag, and the
attribute parameters on the tag.
Thus it should not matter:
* which page the extension is used in
* what other content is on that page
* which order hooks are run in
* how output is cached
etc
If you stray outside that design you're heading into uncharted territory
and surprises should not be... surprising. ;)
Some limited exceptions to using outside info (user preferences, state
of other pages' category memberships) may be made if you're careful
about cache management. You should never, however, make assumptions
about order of execution or other content on the page. No guarantees are
made there and changes to the parser probably will change that in the
future.
-- brion vibber (brion @
pobox.com)