Gordon Mohr (@ Bitzi) wrote:
I'd like my Extension to be able to have an effect
outside the
<!-- start content --> ... <!-- end content --> (especially the
<title> and h1.firstHeading values.
But, I can't find a hook that gets a shot at changing the HTML
which includes those. Am I missing one?
Or, is such a hook trampling on the prerogative of Skins, so it
couldn't be sure to find stable patterns to replace?
If so, can the Skin code be sure the article has already been
parsed/HTMLized, so that it could make use of information found
inside the article body?
The page might never be parsed at all, if it came from the parser cache.
This could be Bad Mojo, but if you simply *must* do this, have your
extension store its data in the parser output structure, and have the
skin check that. (Is that even possible? Who knows, not designed to work
that way.)
Regarding the design:
I'm perplexed about the reason Extensions are handled along with
(and after) the html/nowiki/math/pre/gallery stripping.
Parser-hook extensions are little things that can occur in a wikitext
stream. They take some input (text contents and, since 1.5, optionally
some XML-like attributes) and produce HTML output that does something
special, generally rendering some pretty image or fancy text out of some
foreign formatting specification.
Such extensions do not:
* take any input other than their text contents and attributes
* know what page they are on
* have any affect outside of their little chunk of HTML
The canonical example of an extension is the <math> hook. (It in fact
predates the pluggable extension system and you'll see it's handled
explicitly by name, but it works the same way.)
Some people like to 'cheat' and have their hooks modify external
structures or something, oh well. This can break the system though.
-- brion vibber (brion @
pobox.com)