Edge Rewrite
Jump to content

Wikipedia talk:Lua

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
(Redirected from Wikipedia:Lua requests)
Latest comment: 1 month ago by HouseBlaster in topic Module:String, section transclusion, and Parsoid

Module:String, section transclusion, and Parsoid

[edit]

{{Arbitration standard provisions}} includes the text of, well, ArbCom's standard provisions. It includes the code {{#invoke:String|replace|source={{#section:Wikipedia:Arbitration Committee/Procedures|Standard appeals}}|pattern====*([^=]*)====*|replace=<p>'''%1'''</p>|plain=false}} to replace some HTML headings within Wikipedia:Arbitration Committee/Procedures § Appeals and modifications of enforcement actions with pseudoheaders; this avoid breaking arbitration cases' tables of contents.

This markup works as expected in the legacy parser, but breaks with Parsoid. Any thoughts on how to make this Parsoid-compatible? Thanks, HouseBlaster (talk • he/they) 01:15, 5 August 2026 (UTC)Reply

Looks like the headings come through in the legacy parser like
=='"`UNIQ--h-5--QINU`"' Heading text ==
Section content
, while in Parsoid the whole heading is hidden in the strip marker, like
'"`UNIQ--h-5--QINU`"'
Section content
There doesn't seem to be any way to access the heading text in the Parsoid version; mw.text.unstripNoWiki() doesn't reveal it. This seems worth reporting as a behavior difference in Parsoid, maybe they'll fix it. Anomie⚔ 01:47, 5 August 2026 (UTC)Reply
The other thing you might do is to have a module read the original wikitext of the page and extract the appropriate section directly, instead of using WP:LST and trying to process the half-parsed wikitext. But that might have its own issues. Anomie⚔ 01:47, 5 August 2026 (UTC)Reply
unrelated to the issue, i noticed that the pattern looks perverted.
note that the first = sign after pattern is not part of the pattern, it's the speparator between param name and param value, so the actual pattern is ===*([^=]*)====* (i.e., it requires 3 or more = signs before the group and 4 or more after). I guess this does not create too many problems in real life, but I think you want to fix it. קיפודנחש (aka kipod) (talk) 05:22, 5 August 2026 (UTC)Reply
If anyone wants to try Anomie's suggestion of parsing wikitext, there is a module for that: Module:WikitextParser. Johnuniq (talk) 06:05, 5 August 2026 (UTC)Reply
I created a test implementation in its sandbox at Special:Diff/1367769546. ~ Jenson (SilverLocust 💬) 22:09, 5 August 2026 (UTC)Reply
I've deployed that. Thank you all for your help! Best, HouseBlaster (talk • he/they) 02:13, 6 August 2026 (UTC)Reply