That makes sense. My function did need the stuff rendered before cos I wanted some HTML tags that get stripped by MW, so I found parser->parse()->getText() did the trick, then I do a post parse substitution of the output. Parser functions have made a huge difference though to readability.
Thanks for all the help
Alex
On Thu, Apr 3, 2008 at 6:38 PM, Jim R. Wilson wilson.jim.r@gmail.com wrote:
recursiveTagParse() is really for tag extensions. However, the output from a parser function is inserted into the normal wikitext flow /before/ being rendered into HTML, so you don't have to do it yourself. Just output whatever wikitext you want to have rendered. This facility is what allows parser functions to call eachother, or call one with the output of another (nesting).
However, if you must render the wikitext yourself, you should specify in your output that it's raw html, not wikitext for futher processing. This article talks about how to set that flag:
http://jimbojw.com/wiki/index.php?title=Raw_HTML_Output_from_a_MediaWiki_Par...
Good luck!
-- Jim
On Wed, Apr 2, 2008 at 5:33 PM, Alex Powell alexp@exscien.com wrote:
I was wrong about Parser::parse - that *does* seem to parse the tags (wasn't calling getText) when passed with params 4 and 5 as false. However recursiveTagParse still doesn't work. But anyway I'm happy...
On Wed, Apr 2, 2008 at 11:21 PM, Alex Powell alexp@exscien.com wrote:
Hi,
Now I have implemented it as a parser function it looks much cleaner, but now I have a new problem - I cannot seem to call parser->recursiveTagParse or (Parser:parse for that matter) to process the template parameter - which is normal wiki text. The parameters just appear as flat text. The parser object is passed to the function, but doesn't seem to work the same. Am I missing something or is this a limitation of parser functions that recursiveTagParse can only be used by XML style extensions? If so I'll probably have to go back to the old method until the bug Simetrical pointed out has been fixed - though I guess I could try #tag (shudder)...
Alex
On Tue, Apr 1, 2008 at 9:42 PM, Alex Powell alexp@exscien.com wrote:
Thanks Jim,
I'll try that. Squiggly brackets ahoy!
Alex
On Tue, Apr 1, 2008 at 5:45 PM, Jim R. Wilson wilson.jim.r@gmail.com wrote:
Alex,
Instead of using a <tag>, you should make a {{#parserfunction:}}. The process is similar, but a parser function participates in a much more integrated way with the rest of the parsing process (allowing template parameters for example).
-- Jim R. Wilson (jimbojw)
Alex Powell
Exscien Training Ltd Tel: +44 (0) 1865 920024 Direct: +44 (0) 1865 920032 Mob: +44 (0) 7717 765210
skype: alexp700 mailto:alexp@exscien.com http://www.exscien.com
Registered in England and Wales 05927635, Unit 10 Wheatley Business Centre, Old London Road, Wheatley, OX33 1XW, England
--
Alex Powell
Exscien Training Ltd Tel: +44 (0) 1865 920024 Direct: +44 (0) 1865 920032 Mob: +44 (0) 7717 765210
skype: alexp700 mailto:alexp@exscien.com http://www.exscien.com
Registered in England and Wales 05927635, Unit 10 Wheatley Business Centre, Old London Road, Wheatley, OX33 1XW, England
-- Alex Powell
Exscien Training Ltd Tel: +44 (0) 1865 920024 Direct: +44 (0) 1865 920032 Mob: +44 (0) 7717 765210
skype: alexp700 mailto:alexp@exscien.com http://www.exscien.com
Registered in England and Wales 05927635, Unit 10 Wheatley Business Centre, Old London Road, Wheatley, OX33 1XW, England
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l