Page MenuHomePhabricator

HTML markup sanitisation discrepancy when passed as a named parameter or a positional parameter
Closed, DuplicatePublic

Description

In MW 1.30, given the following simple template that I use in documenting templates:

Template:parameter

<onlyinclude>; {{{name|{{{1|}}}}}} : {{{description|{{{2|}}}}}}</onlyinclude>
[[category:template documentation templates]]

If I include in a page:

{{parameter|publication_date|for example: <kbd dir="ltr">2016-11-1</kbd>}}

then the value of {{{2}}} is omitted from the output. Not only the text within <kbd> tag, but everything including the string "for example:" is omitted.

But if I use a named parameter then it works as expected:

{{parameter|publication_date|description=for example: <kbd dir="ltr">2016-11-1</kbd>}}

note: If you wonder about this specific example and the need for LTR, it's because my actual case is in Arabic and I sometimes need to enforce LTR because of BiDi blues.

Event Timeline

ahmad created this task.Apr 14 2018, 9:57 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 14 2018, 9:57 PM

In case of:

{{parameter|publication_date|for example: <kbd dir="ltr">2016-11-1</kbd>}}

The second parameter has the name for example: <kbd dir and the value is "ltr">2016-11-1</kbd>
This is a parser feature and does not have todo with tidy, because the splitting is done before tidy is working. You can see this on Special:ExpandTemplates with the xml mode enabled:

<root>
  <template>
    <title>parameter</title
    <part>
      <name index="1"/>
      <value>publication_date</value>
    </part>
    <part>
      <name>for example: &lt;kbd dir</name>
      <equals>=</equals>
      <value>&quot;ltr&quot;&gt;2016-11-1&lt;/kbd&gt;</value>
    </part>
  </template>
</root>

Ah, thanks (as usual), Umherirrender!