Hi Roan,
Thankyou. recursiveTagParse seems to work better - and avoids my ugly hack.
They're all set up with setFunctionHook as parser functions, and no I was
not on Main Page with the test. I am in a slightly complicated position as I
am also in a parser hook wrapping them up - a legacy design that gained
traction I don't want to remove if I don't have to - possibly that is
interferring with internalparse...
Kind regards,
Alex
2009/1/13 Roan Kattouw <roan.kattouw(a)home.nl>
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)
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
--
Alex Powell
Exscien Training Ltd
Tel: +44 (0) 1865 876562
Mob: +44 (0) 759 5048178
skype: alexp700
mailto:alexp@exscien.com
Registered in England and Wales 05927635, Unit 10 Wheatley Business Centre,
Old London Road, Wheatley, OX33 1XW, England