ArthurTaylor added a comment.

  I did some more digging today. Per the comments from Isabelle in this slack 
thread 
<https://wikimedia-crew.slack.com/archives/C01R06P8D1B/p1704805593675949>, when 
Parsoid processes Wikitext, it spins up an isolated sub-parse with its own 
ParserOutput. Specifically for Templates, it has a `TemplateHandler` that 
spawns a wikitext preprocessor 
<https://gerrit.wikimedia.org/g/mediawiki/services/parsoid/+/178fe89fb26fffc2784fcbf3865d094ef32a2bab/src/Wikitext/Wikitext.php>
 when it encounters a template tag 
<https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/services/parsoid/+/178fe89fb26fffc2784fcbf3865d094ef32a2bab/src/Wt2Html/TT/TemplateHandler.php#1053>.
  
  The preprocessor runs the Lua correctly, and the usages are always registered 
in the `ExtensionData` of the parserOutput object present in the context of the 
Lua parse. But this parserOutput object is not the object that is eventually 
passed up to the output of the ParsoidCachePrewarmJob.
  
  There is code to collect the usages 
<https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/5d3a549326018ebdca1bb35d6d43608f86c73d8b/includes/parser/Parsoid/Config/DataAccess.php#398>
 from the internal parse, which often / mostly works. The `collectMetadata` 
function transfers the `ExtensionData` to the active parserOutput object.
  
  What I suspect is happening is that for some recursive templates, whatever is 
doing the recursion is at some point just replacing the template text with the 
rendered text and throwing away the parserOutput. Specifically we know that in 
this template 
<https://eo.wikipedia.org/w/index.php?title=%C5%9Cablono:Informkesto_rolulo&action=edit>
 the addition of P509 <https://phabricator.wikimedia.org/P509> in the lua code:
  
    {{Informkesto/Opcia linio2
     
|priskribo=Mortokialo|teksto={{#invoke:Wikidata|claim|P509|parameter=link|list=,&#32;}}
    }}
  
  does not get propagated up. I will have a look again tomorrow to see if I can 
spot why.

TASK DETAIL
  https://phabricator.wikimedia.org/T255706

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: ArthurTaylor
Cc: ArthurTaylor, hoo, Lucas_Werkmeister_WMDE, ItamarWMDE, Ladsgroup, Krinkle, 
eprodromou, aaron, Michael, Aklapper, thcipriani, Danny_Benjafield_WMDE, 
Isabelladantes1983, Themindcoder, Adamm71, Jersione, Hellket777, LisafBia6531, 
Astuthiodit_1, 786, Biggs657, karapayneWMDE, Invadibot, maantietaja, Juan90264, 
Alter-paule, Beast1978, Un1tY, Akuckartz, Hook696, darthmon_wmde, Rosalie_WMDE, 
Kent7301, joker88john, CucyNoiD, Nandana, Gaboe420, Giuliamocci, Cpaulf30, 
Lahi, Gq86, Af420, Bsandipan, GoranSMilovanovic, QZanden, KimKelting, 
LawExplorer, Lewizho99, Maathavan, _jensen, rosalieper, Neuronton, Scott_WUaS, 
Verdy_p, Wikidata-bugs, aude, Jdforrester-WMF, Mbch331, Jay8g
_______________________________________________
Wikidata-bugs mailing list -- wikidata-bugs@lists.wikimedia.org
To unsubscribe send an email to wikidata-bugs-le...@lists.wikimedia.org

Reply via email to