twinkle icon indicating copy to clipboard operation
twinkle copied to clipboard

protect: when adding padlock icon, add a line break if wikicode starts with a heading (==)

Open NovemLinguae opened this issue 1 year ago • 2 comments

Reported by Star Mississippi at https://en.wikipedia.org/wiki/Wikipedia_talk:Twinkle#Protection_template_breaking_AfD

Bug: https://en.wikipedia.org/w/index.php?title=Wikipedia:Articles_for_deletion/Dilshad_Kamaludheen_(2nd_nomination)&diff=prev&oldid=1176550685

Fix: https://en.wikipedia.org/w/index.php?title=Wikipedia:Articles_for_deletion/Dilshad_Kamaludheen_(2nd_nomination)&diff=prev&oldid=1176561213

This bug may be specific to the "noinclude" code path

NovemLinguae avatar Sep 22 '23 18:09 NovemLinguae

This bug may be specific to the "noinclude" code path

Indeed it is

The specific cause of this issue seems to arise from twinkleprotect.js#L1487 (and the code for other content models just above), in which the version with a <noinclude> tag doesn't have a \n automatically put at the end of its tag text.

I would say to just add a newline to keep the same behaviour with or without the noinclude text, but I'm not sure if that could screw up tagging on template pages, where bringing in a sudden newline at the top of the page could potentially break output (I don't personally use twinkle so I'm not sure how realistic of a scenario this is, or if the newline could even be problematic in most scenarios), so I won't be submitting a PR to add it myself for now

9382 avatar Nov 14 '23 09:11 9382