Page MenuHomePhabricator

Extension:Indicator renders as a <link /> in Parsoid/PHP and a <span></span> in Parsoid/JS
Closed, ResolvedPublic

Description

ssastry@scandium:/srv/deployment/parsoid/deploy/src/bin$ node diff.html.js ru.wikipedia.org 'Пишляйка'
----- JS:[12882, 15574] -----
<span typeof="mw:Extension/indicator" about="#mwtX" data-mw='{"name":"indicator","attrs":{"name":"0-coord"},"body":{"extsrc":"&lt;span class=\"coordinates plainlinks nourlexpansion\" data-param=\"53.191627_N_41.475502_E_scale:100000_region:RU_type:river\">&lt;span title=\"Показать карту\">&lt;maplink lang=\"ru\" latitude=\"53.191627\" longitude=\"41.475502\" text=\"53°11′30″&amp;amp;nbsp;с.&amp;amp;nbsp;ш. 41°28′32″&amp;amp;nbsp;в.&amp;amp;nbsp;д.\" title=\"Пишляйка, устье\" zoom=\"12\">[ {\n\t\t\"type\": \"Feature\",\n\t\t\"geometry\": {\n\t\t\t\"type\": \"Point\",\n\t\t\t\"coordinates\": [\n\t\t\t\t41.475502,\n\t\t\t\t53.191627\t\t\t]\n\t\t},\n\t\t\"properties\": {\n\t\t\t\"title\": \"Пишляйка, устье\",\n\t\t\t\"marker-symbol\": \"water\",\n\t\t\t\"marker-color\": \"#3366cc\"\n\t\t}\n\t} , {\n\t\t\t\"type\": \"ExternalData\",\n\t\t\t\"service\": \"geoline\",\n\t\t\t\"ids\": \"Q3720985\",\n\t\t\t\"properties\": {\n\t\t\t\t\"stroke\": \"#FF9999\"\n\t\t\t}\n\t\t}, {\n\t\t\t\"type\": \"ExternalData\",\n\t\t\t\"service\": \"geoshape\",\n\t\t\t\"ids\": \"Q3720985\",\n\t\t\t\"properties\": {\n\t\t\t\t\"fill\": \"#FF0000\",\n\t\t\t\t\"fill-opacity\": 0.1,\n\t\t\t\t\"stroke\": \"#FF9999\"\n\t\t\t}\n\t\t} ]&lt;/maplink>&lt;/span>&lt;sup class=\"geo-services noprint\">&lt;span class=\"geo-geohack\" title=\"Карты и инструменты на GeoHack\">[//tools.wmflabs.org/geohack/geohack.php?language=ru&amp;pagename=%D0%9F%D0%B8%D1%88%D0%BB%D1%8F%D0%B9%D0%BA%D0%B0&amp;params=53.191627_N_41.475502_E_scale:100000_region:RU_type:river&amp;title=%D0%9F%D0%B8%D1%88%D0%BB%D1%8F%D0%B9%D0%BA%D0%B0%2C+%D1%83%D1%81%D1%82%D1%8C%D0%B5 &lt;span>H&lt;/span>]&lt;/span>&lt;span class=\"geo-google\" title=\"Это место на «Картах Google»\">[//maps.google.com/maps?ll=53.191627,41.475502&amp;q=53.191627,41.475502&amp;spn=0.1,0.1&amp;t=h&amp;hl=ru &lt;span>G&lt;/span>]&lt;/span>&lt;span class=\"geo-yandex\" title=\"Это место на «Яндекс.Картах»\">[//yandex.ru/maps/?ll=41.475502,53.191627&amp;pt=41.475502,53.191627&amp;spn=0.1,0.1&amp;l=sat,skl &lt;span>Я&lt;/span>]&lt;/span>&lt;span class=\"geo-osm\" title=\"Это место на карте OpenStreetMap\">[http://www.openstreetmap.org/?mlat=53.191627&amp;mlon=41.475502&amp;zoom=12 &lt;span>O&lt;/span>]&lt;/span>&lt;span class=\"geo-loadmap\" style=\"display: none;\" title=\"Это место на картах ГШ и ГУГК\">[http://loadmap.net/ru?q=53.191627%2041.475502&amp;z=12&amp;s=0 &lt;span>L&lt;/span>]&lt;/span>&lt;/sup>&lt;/span>"}}'>

</span>
...
+++++ PHP:[15891, 18352] +++++
<link typeof="mw:Extension/indicator" about="#mwtX" data-mw='{"name":"indicator","attrs":{"name":"0-coord"},"body":{"extsrc":"&lt;span class=\"coordinates plainlinks nourlexpansion\" data-param=\"53.191627_N_41.475502_E_scale:100000_region:RU_type:river\">&lt;span title=\"Показать карту\">&lt;maplink lang=\"ru\" latitude=\"53.191627\" longitude=\"41.475502\" text=\"53°11′30″&amp;amp;nbsp;с.&amp;amp;nbsp;ш. 41°28′32″&amp;amp;nbsp;в.&amp;amp;nbsp;д.\" title=\"Пишляйка, устье\" zoom=\"12\">[ {\n\t\t\"type\": \"Feature\",\n\t\t\"geometry\": {\n\t\t\t\"type\": \"Point\",\n\t\t\t\"coordinates\": [\n\t\t\t\t41.475502,\n\t\t\t\t53.191627\t\t\t]\n\t\t},\n\t\t\"properties\": {\n\t\t\t\"title\": \"Пишляйка, устье\",\n\t\t\t\"marker-symbol\": \"water\",\n\t\t\t\"marker-color\": \"#3366cc\"\n\t\t}\n\t} , {\n\t\t\t\"type\": \"ExternalData\",\n\t\t\t\"service\": \"geoline\",\n\t\t\t\"ids\": \"Q3720985\",\n\t\t\t\"properties\": {\n\t\t\t\t\"stroke\": \"#FF9999\"\n\t\t\t}\n\t\t}, {\n\t\t\t\"type\": \"ExternalData\",\n\t\t\t\"service\": \"geoshape\",\n\t\t\t\"ids\": \"Q3720985\",\n\t\t\t\"properties\": {\n\t\t\t\t\"fill\": \"#FF0000\",\n\t\t\t\t\"fill-opacity\": 0.1,\n\t\t\t\t\"stroke\": \"#FF9999\"\n\t\t\t}\n\t\t} ]&lt;/maplink>&lt;/span>&lt;sup class=\"geo-services noprint\">&lt;span class=\"geo-geohack\" title=\"Карты и инструменты на GeoHack\">[//tools.wmflabs.org/geohack/geohack.php?language=ru&amp;pagename=%D0%9F%D0%B8%D1%88%D0%BB%D1%8F%D0%B9%D0%BA%D0%B0&amp;params=53.191627_N_41.475502_E_scale:100000_region:RU_type:river&amp;title=%D0%9F%D0%B8%D1%88%D0%BB%D1%8F%D0%B9%D0%BA%D0%B0%2C+%D1%83%D1%81%D1%82%D1%8C%D0%B5 &lt;span>H&lt;/span>]&lt;/span>&lt;span class=\"geo-google\" title=\"Это место на «Картах Google»\">[//maps.google.com/maps?ll=53.191627,41.475502&amp;q=53.191627,41.475502&amp;spn=0.1,0.1&amp;t=h&amp;hl=ru &lt;span>G&lt;/span>]&lt;/span>&lt;span class=\"geo-yandex\" title=\"Это место на «Яндекс.Картах»\">[//yandex.ru/maps/?ll=41.475502,53.191627&amp;pt=41.475502,53.191627&amp;spn=0.1,0.1&amp;l=sat,skl &lt;span>Я&lt;/span>]&lt;/span>&lt;span class=\"geo-osm\" title=\"Это место на карте OpenStreetMap\">[http://www.openstreetmap.org/?mlat=53.191627&amp;mlon=41.475502&amp;zoom=12 &lt;span>O&lt;/span>]&lt;/span>&lt;span class=\"geo-loadmap\" style=\"display: none;\" title=\"Это место на картах ГШ и ГУГК\">[http://loadmap.net/ru?q=53.191627%2041.475502&amp;z=12&amp;s=0 &lt;span>L&lt;/span>]&lt;/span>&lt;/sup>&lt;/span>"}}'/>

Event Timeline

ssastry created this task.Oct 10 2019, 10:19 PM
Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald TranscriptOct 10 2019, 10:19 PM
ssastry triaged this task as Medium priority.Oct 10 2019, 10:20 PM
ssastry moved this task from Backlog to Bugs, Notices, Crashers on the Parsoid-PHP board.

This is not because of the indicator extension but because of the maplink extension that surrounds it. This was traced to the ParserAfterParse parser hook not being invoked for the Kartographer extension.

Change 543167 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] WIP: Run more hooks for extension parses

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

ssastry closed this task as Resolved.Oct 16 2019, 1:25 PM

This is not because of the indicator extension but because of the maplink extension that surrounds it. This was traced to the ParserAfterParse parser hook not being invoked for the Kartographer extension.

A link gets created when the extension doesn't return a body,
https://github.com/wikimedia/parsoid/blob/master/lib/wt2html/tt/ExtensionHandler.js#L207-L210

On the JS side, it looks like the content of the parse is just a newline and a category, which is the result of the mangling we do to the parse response and is fixed by,

https://github.com/wikimedia/parsoid/commit/3551920a2c2c0cf5a1cb1baba85850aa848335f3