On 7/11/05, Brion Vibber <brion(a)pobox.com> wrote:
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.
Ah, okay. I may try digging around a little there.
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. ;)
I consider myself warned 8-)
To be honest, I think I will keep pursuing this line for the minute as
it seems the most expedient way of getting what I want (essentially
nested custom elements, but without nesting tags - quite similar to
how the different levels of headings, ==, ===, etc., work now), but
will try to be very rigorous in my testing before upgrading.
Thanks very much for the clear and prompt response, Brion. Yours,
Stephen.