Page MenuHomePhabricator

Parsoid HTML for articles about numerals contains unparsed Lua invocations
Closed, ResolvedPublicBUG REPORT

Assigned To
None
Authored By
hueitan
Mar 23 2020, 1:06 PM
Referenced Files
F35683722: Screenshot 2022-10-31 at 10.55.54.png
Oct 31 2022, 5:57 PM
F35683724: Screenshot 2022-10-31 at 10.52.25.png
Oct 31 2022, 5:57 PM
F31746697: image.png
Apr 9 2020, 1:34 PM
F31700334: Screen Shot 2020-03-24 at 18.33.19.png
Mar 24 2020, 5:38 PM
F31700325: Screen Shot 2020-03-24 at 18.19.17.png
Mar 24 2020, 5:37 PM
F31700329: Screen Shot 2020-03-24 at 18.36.31.png
Mar 24 2020, 5:37 PM
F31700323: Screen Shot 2020-03-24 at 18.33.09.png
Mar 24 2020, 5:37 PM
F31698927: Screen Shot 2020-03-23 at 14.04.55.png
Mar 23 2020, 1:06 PM

Description

Issue

The "quick facts" section of any article about a numeral (on enwiki) rendered by Parsoid contains a large, unparsed Lua invocation.

Screen Shot 2020-03-23 at 14.05.16.png (435×360 px, 29 KB)
Screen Shot 2020-03-23 at 14.04.55.png (435×360 px, 29 KB)

Result

View the Quick Facts for any Parsoid HTML for any article about a numeral, e.g., https://en.wikipedia.org/api/rest_v1/page/html/9.

Expected

The expression is parsed and the content is rendered as it appears on mobile web.

image.png (611×376 px, 27 KB)

Event Timeline

Here's another example of number 16.

The api returns the remaining infobox with valid elements, but not to the first line, can we consult API regarding the difference?

QucikfactRemove first lineMobile Web
Screen Shot 2020-03-24 at 18.33.09.png (435×360 px, 29 KB)
Screen Shot 2020-03-24 at 18.33.19.png (435×360 px, 22 KB)
Screen Shot 2020-03-24 at 18.36.31.png (435×360 px, 14 KB)
AMuigai changed the subtype of this task from "Task" to "Bug Report".Apr 9 2020, 2:34 PM

@Mholloway any idea why this page (and other number articles) contains a big unparsed expression? https://en.wikipedia.org/api/rest_v1/page/mobile-html/9

Mholloway renamed this task from Renders Quickfact in any number article to Parsoid HTML for articles about numerals contain unparsed Lua invocations.May 12 2020, 6:47 PM
Mholloway renamed this task from Parsoid HTML for articles about numerals contain unparsed Lua invocations to Parsoid HTML for articles about numerals contains unparsed Lua invocations.
Mholloway updated the task description. (Show Details)
Mholloway updated the task description. (Show Details)
ssastry subscribed.

https://en.wikipedia.org/w/api.php?action=expandtemplates&text={{Infobox%20number|number=9}} displays the same bug. While Parsoid/PHP doesn't use the MediaWiki API, it uses the underlying code internally. So, the rabbit hole goes deeper. We'll have to go look at the preprocessor code very likely.

Took a quick look at the template source. Chasing the template chain, that particular output seems to be coming from https://en.wikipedia.org/w/index.php?title=Template:Infobox_number/range&action=edit and specifically this https://en.wikipedia.org/w/api.php?action=expandtemplates&text={{Infobox%20number/range|9}} isn't expanded as you would expect.

Arlolra subscribed.

The template uses https://en.wikipedia.org/wiki/Module:For_nowiki which has a call to code = mw.text.unstripNoWiki(code)

So, this is a manifestation of T203293 / T270127 / T257606

As a further-root-cause, the "use <nowiki> to protect module/template arguments" problem is a hack which is intended to be solved "properly" by T114432: [RFC] Heredoc arguments for templates (aka "hygienic" or "long" arguments). But of course we still have to support existing uses during the transition as well an implementing the "right" way to do it...

nshahquinn-wmf subscribed.

The example given in the description (https://en.wikipedia.org/api/rest_v1/page/html/9) now renders correctly:

Screenshot 2022-10-31 at 10.52.25.png (222×326 px, 21 KB)

The same page also renders correctly in the KaiOS app simulator, with the template hidden (which is probably the desired result):

Screenshot 2022-10-31 at 10.55.54.png (258×239 px, 22 KB)

Unless I'm missing something, this has been fixed.

Yes, probably fixed by my updates for T272507: mw.text.unstripNoWiki doesn't unstrip when using Parsoid (unless editors had tweaked their templates to make them work with Parsoid even before my fix). I was waiting to verify T272507 changes before resolving it. So, this report is good to hear.