Page MenuHomePhabricator

Parsoid doesn't handle parser functions in HTML attributes correctly
Closed, ResolvedPublic

Description

This below is self-explanatory.

$ echo '<div style="background-color:{{#if: #DCDCDC|#DCDCDC|#F0F0F0}};">foo</div>' | php bin/parse.php                                                                                                    130 ↵
<div style="background-color:
DCDCDC;" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"background-color:\nDCDCDC;"},"sa":{"style":"background-color:{{#if: #DCDCDC|#DCDCDC|#F0F0F0}};"},"dsr":[0,73,64,6]}' data-mw='{"attribs":[[{"txt":"style"},{"html":"background-color:&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"},{\"k\":\"2\"}]],\"dsr\":[29,62,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#if: #DCDCDC\",\"function\":\"if\"},\"params\":{\"1\":{\"wt\":\"#DCDCDC\"},\"2\":{\"wt\":\"#F0F0F0\"}},\"i\":0}},\";\"]}&apos;>\n&lt;/span>&lt;ol about=\"#mwt1\" data-parsoid=&apos;{\"dsr\":[null,62,0,0]}&apos;>&lt;li data-parsoid=&apos;{\"dsr\":[null,62,1,0]}&apos;>DCDCDC;&lt;/li>&lt;/ol>"}]]}'>foo</div>

This causes rendering diffs on several pages where this pattern is used to style div tags.

Event Timeline

Change 979412 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/services/parsoid@master] WIP: Fix buggy T2529 handling

https://gerrit.wikimedia.org/r/979412

Change 979412 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Fix gaps in handling templates & parser functions in attributes

https://gerrit.wikimedia.org/r/979412

Change 982166 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.19.0-a8

https://gerrit.wikimedia.org/r/982166

Change 982166 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.19.0-a8

https://gerrit.wikimedia.org/r/982166