On Tue, Oct 4, 2011 at 1:42 PM, Daniel Barrett danb@vistaprint.com wrote:
Is there a function in MediaWiki core that applies "nowiki" transformations to a string? For example, I'm writing a parser function, and I want its output to be the literal string:
'''foo'''
and not a boldface <b>foo</b>.
I tried CoreParserTags::nowiki(), but this only escapes angled brackets.
There's a couple different things you might want here.
One is wfEscapeWikiText(), which does HTML-style charcter reference encoding on a bunch of characters that would otherwise get interpreted as some sort of markup. This gets used in various places when producing output that's meant to render as plain text in a wiki-ish bit.
Another thing you may be able to do is to actually insert a 'nowiki' extension node into your output, using the fancy object tree return (maybe?) or just by sticking it in a literal '<nowiki>...</nowiki>' in your returned string.
-- brion