Page MenuHomePhabricator

"[[File:Information icon.svg|20px|link=||alt=]]" misparsed inside a table
Closed, DuplicatePublic



Works – generates an <img alt="" …>, without wrapping link:

[[File:Information icon.svg|20px|link=||alt=]]

Doesn't work – generates <a…><img alt="" …></a>

| [[File:Information icon.svg|20px|link=||alt=]]

Works again:

[[File:Information icon.svg|20px|link=||alt=]]
| [[File:Information icon.svg|20px|link=|alt=]]

Event Timeline

matmarex created this task.Dec 7 2014, 9:42 PM
matmarex raised the priority of this task from to Needs Triage.
matmarex updated the task description. (Show Details)
matmarex added a project: MediaWiki-Parser.
matmarex changed Security from none to None.
matmarex added a subscriber: matmarex.

This affects the output of, which is how I ran into this. The template is used (via other templates) on 170k+ pages on the Polish Wikipedia (luckily most uses don't trigger this issue).

Okay, here's what's going on in the broken case: In Parser::parse, doTableStuff is running before replaceInternalLinks, which turns "[[File:Information icon.svg|20px|link=||alt=]]" into "[[File:Information icon.svg|20px|link=</td>
<td>alt=]]". Unsurprisingly, when replaceInternalLinks then gets called on that mess, it doesn't do you what you wanted.

As for why it works in the other cases: In the first case, it works since there's no table, so nothing for doTableStuff to do. In the third case, it works because || is only special to tables when it's on the same line as a leading |. In the fourth case, it works since there's no more ||.

As for how to fix this, I know we already annotate the "main" pipe in internal links somehow; perhaps doing something similar for the rest of the pipes will be needed to fix this.

Also, this doesn't just affect files:

[[Some page||This link's text is supposed to start with a pipe]]


| [[Some page||This link's text is supposed to start with a pipe]]
Aklapper triaged this task as Low priority.Dec 8 2014, 11:17 AM