jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/636454 )
Change subject: [bugfix] Ignore duplication replacements inside templates ......................................................................
[bugfix] Ignore duplication replacements inside templates
Bug: T266411 Change-Id: Icab1f27c4ae7f3cb8fff3dd3ffab2d63c800a47b --- M scripts/reflinks.py 1 file changed, 4 insertions(+), 1 deletion(-)
Approvals: Rubin: Looks good to me, but someone else must approve Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/reflinks.py b/scripts/reflinks.py index 7b9c621..9e4c25c 100755 --- a/scripts/reflinks.py +++ b/scripts/reflinks.py @@ -63,6 +63,7 @@ from pywikibot.pagegenerators import ( XMLDumpPageGenerator as _XMLDumpPageGenerator, ) +from pywikibot.textlib import replaceExcept from pywikibot.tools.formatter import color_format
from scripts import noreferences @@ -375,7 +376,9 @@
unnamed = '<ref {}name={} />'.format(group, name) for ref in v[1][1:]: - end = end.replace(ref, unnamed) + # Don't replace inside templates (T266411) + end = replaceExcept(end, re.escape(ref), unnamed, + exceptions=['template']) text = header + end
for (k, v) in named_repl.items():
pywikibot-commits@lists.wikimedia.org