[Mediawiki-l] Cloning the parser?

Daniel Barrett danb at VistaPrint.com
Wed Sep 8 19:07:06 UTC 2010


What is the simplest, correct way to create a new Parser object with the same initialization as the current Parser object (e.g., $wgParser)?   An actual code fragment would be great.

Application: I have written an parser function extension that, internally, needs to parse several other wiki pages to complete its task. When I do this with the Parser object supplied to my hook function, there are all kinds of unwanted side-effects.   For example, the ParserOutput's category links get applied to the current article, which I don't want, but if I delete them (e.g., $parserOutput->setCategoryLinks(array())), this causes worse problems.  So I'd rather use a fresh new Parser, except it doesn't have all the tag extensions & parser functions initialized, and probably a bunch of other things missing too....

Thanks,
DanB




More information about the MediaWiki-l mailing list