[Mediawiki-i18n] wfMessage()->parse() produces unexpected <pre> tag
S Page
spage at wikimedia.org
Fri Jan 3 02:11:45 UTC 2014
Flow was supplying an empty string as a parameter to a message, due to a
bug 59198. What surprised me is the rendered HTML turned into a
preformatted (typewriter-style) block. This happens because the
'flow-topic-participants' message goes through parse(), and in wikitext a
leading blank formats the text as a <pre> tag. You can see this using
eval.php:
> echo wfMessage( 'flow-topic-participants', 2, 2, '', 'second person'
)->parse();
(note the empty string for first participant); this prints
<pre>and second person
</pre>
1) Is there a way to turn off this over-aggressive parsing? It's unwanted
for an i18n string you know should just be a span.
2) Is there an idiom to guard against this unintended <pre> tag generation,
without making the message[1] even more complicated? E.g. we could put some
zero-width Unicode character at the start.
Thanks as always in advance,
[1]
'flow-topic-participants' => '{{PLURAL:$1|$3 started this
topic|{{GENDER:$3|$3}}, {{GENDER:$4|$4}}, {{GENDER:$5|$5}} and $2
{{PLURAL:$2|other|others}}|0=No participation yet|2={{GENDER:$3|$3}} and
{{GENDER:$4|$4}}|3={{GENDER:$3|$3}}, {{GENDER:$4|$4}} and {{GENDER:$5|$5}}}}
--
=S Page WMF Features engineer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wikimedia.org/pipermail/mediawiki-i18n/attachments/20140102/734e73a2/attachment.html>
More information about the Mediawiki-i18n
mailing list