Page MenuHomePhabricator

Templates expanding to mapframe extensions with large bodies exceed wikitext limits
Open, MediumPublicBUG REPORT

Description

See https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox&oldid=1032656599 for an example of this apparent false positive error. This is the most minimal case I was able to construct.

What happens?:
Part of the caption wikitext is detected as a Linter bogus file option, even though the caption renders fine and templates are generally supported within image captions.

For some reason, removing either of the two templates at the top of the page eliminates the Linter error. I am assuming that this is a Linter false positive error caused by some quirk of Linter's error-detection regular expressions.

What should have happened instead?:
Linter should not show an error for this wikitext.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:

Event Timeline

Arlolra triaged this task as Medium priority.Nov 29 2022, 8:43 PM
Arlolra added a project: Parsoid.
Arlolra subscribed.

For some reason, removing either of the two templates at the top of the page eliminates the Linter error.

Expanding either of those templates {{Map of heritage railways in Great Britain}} in https://en.wikipedia.org/wiki/Special:ExpandTemplates shows an exceedingly large mapframe,

<mapframe text="Interactive map of standard gauge heritage railways in Great Britain." latitude="53.958333" longitude="-1.080278" zoom="5" width="300" height="300" align="right">
{
  "type": "FeatureCollection",
  "generator": "overpass-ide",
  ...

Stacking two of them together is going to run afoul of the wikitext size limit in Parsoid, 'wikitextSize' => 2048 * 1024, // ParserOptions::maxIncludeSize
https://github.com/wikimedia/parsoid/blob/master/src/Config/SiteConfig.php#L1661-L1662

Once that's hit, templates will no longer be expanded,
https://github.com/wikimedia/parsoid/blob/master/src/Wt2Html/TT/TemplateHandler.php#L1005-L1023

so from [[File:Craignure Station.jpg|thumb|right|Craignure station on the {{nowrap|10.25in}} gauge Isle of Mull railway]], the | in {{nowrap|10.25in}} will be interpreted as a file option delineator and you'll get two captions, Craignure station on the {{nowrap and 10.25in}} gauge Isle of Mull railway. Since the last one wins, the former is noted as,

{"type":"bogus-image-options","dsr":[0,113,2,2],"params":{"items":["Craignure station on the {{nowrap"]}}

Note that in https://en.wikipedia.org/api/rest_v1/page/html/User:Jonesey95%2Fsandbox/1032656599, we have,

wt2html: wikitextSize limit exceeded

The difference in limits between the parsers is tracked in tasks like, T254522 / T254508

Arlolra renamed this task from Linter apparent false positive: template in caption, in combination with other templates to Templates expanding to mapframe extensions with large bodies exceed wikitext limits.Nov 29 2022, 8:45 PM
cscott subscribed.

Can we verify that this will affect Parsoid read views of the page as well? I'm assuming it would. Where does this occur in the wild?

This occurred in the wild here:
https://en.wikipedia.org/w/index.php?title=List_of_British_heritage_and_private_railways&oldid=1032658072

I don't just make up weird edge cases. Editors are much better at that. I just stumble across them in reports and fix them, unless they appear to be bugs. Thanks for looking into this.