[Mediawiki-l] Use of Linker::link in parser function?

Daniel Barrett danb at VistaPrint.com
Wed Apr 21 17:40:16 UTC 2010


What is the right way to produce a link to an existing article within a parser function?  I tried Linker::link() embedded within a bunch of Xml::openElement and Xml::closeElement calls, and the "A" tag got escaped. So this PHP code:

Xml::openElement('li')
. $linker->link($title)
. Xml::closeElement('li')

rendered as escaped like this:

<ul><li> &lt;a href=http://mywiki/wiki/articlename&gt; </li></ul>

etc.

Maybe this is because parser functions return wikitext and Linker::link() returns HTML...?

I don't want to produce a manual "A" tag with Xml::element('a') because I need the rest of the intelligence of Linker::link(), like redlinking for nonexistent articles.

Thanks,
DanB




More information about the MediaWiki-l mailing list