Hi,
the ParserBeforeStrip hook call is a nice hook to allow extensions to
manipulate the text before the MediaWiki parser has a go at actually parsing
the wikitext, unfortunately at the moment the hook isn't called for texts
which are included via a template inside an article.
eg text of the Main_Page:
some ''text''
{{Template:Some_Template}} <-- wikitext inside the template isn't
passed to the ParserBeforeStrip call
A proposal for fix which allows also preparsing for wikitext included in
templates (it works for me, but which you might want to review for inclusion
in the main code):
original code:
function replaceVariables( $text, $args = array(), $argsOnly = false ) {
... snip code for readability ...
wfProfileOut( $fname );
return $text;
}
replace this with:
function replaceVariables( $text, $args = array(), $argsOnly = false ) {
... snip code for readability ...
wfProfileOut( $fname );
wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text,
&$this->mStripState ) );
return $text;
}
The replaceVariables function is called to replace magic variables,
templates and template variables, so the extra call to the ParserBeforeStrip
hook might occur to often as it'll also do the call for template variables
and magic variables besides templates text, but when the hook call is
included there extensions can now also have a go now at preparsing included
templates without needing to know that the text comes from a template (as
the hook call is the same in the 'regular' parse function which is used to
parse the main text...
If you know a better place for the extra hook call, I'd love to hear your
suggestions...
Cheers,
Peter.