Alex Powell schreef:
Hi,
I have an extension that needs to parse some wiki text. I started with:
$title = $parser->internalParse($title);
but found that links were not always processing correctly [[Main Page]] was
saying as that, but interestingly the first [[:image: ]] tags was parsing
You mean [[Main Page]] didn't turn into a link while [[:Image:Foo.jpg]]
did? Are you sure [[Main Page]] isn't a self-link?
$title =
$parser->parse($title,$wgTitle,ParserOptions::newFromUser($wgUser),false,false)->getText();
... however did. This is with MW 1.13.1.
However now the batch processes take forever, and the culprit is the
"->parse" - it seems to take exponentially longer to run. internalParse
runs
quicker, so for the time being I have detected commandline functions and
NS_SPECIAL pages and sent it that way (as I don't really care if the pages
parse correctly or not there).
Are there any expected known limitations of internalParse? Should it always
output the same as parse or are there certain cases which will never work
with it?
Are you doing this inside a hook that's called by the parser? If so,
you
should not call $parser->parse() but use $parser->recursiveTagParse()
instead (I don't know whether $parser->internalParse() is forbidden as
well).
Roan Kattouw (Catrope)