twinkle
twinkle copied to clipboard
Protection template removal newline issue
As seen in this edit, Twinkle removes too many newlines when removing a page protection template.
The issue seems to arise from the regex used for finding and removing the protection template (twinkleprotect.js#L1447) checking for whitespace on both sides of the main template finding
The rough layout of the regex is: optional /*
, whitespace, optional <noinclude>
, whitespace, the template, whitespace, optional </noinclude>
, whitespace, optional */
, whitespace
Perhaps moving the \s*
into the optional capture groups for /*
and <noinclude>
could help prevent this issue? This would mean it only attempts to remove whitespace ahead of it in regular occurances of the text, which I imagine would be fine