jenkins-bot has submitted this change and it was merged.
Change subject: Add "category" and "file" as exemptions in ReplaceExampt ......................................................................
Add "category" and "file" as exemptions in ReplaceExampt
Implemented from compat
- synchronized with compat by xqt
Change-Id: I062f21c592a04cbc872cf287a6873410c70ed864 --- M pywikibot/textlib.py 1 file changed, 6 insertions(+), 2 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index c30b678..f1df622 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -94,6 +94,10 @@ 'property': re.compile(r'(?i){{\s*#property:\s*p\d+\s*}}'), # Module invocations (currently only Lua) 'invoke': re.compile(r'(?i){{\s*#invoke:.*?}}'), + # categories + 'category': re.compile(ur'[[ *(?:%s)\s*:.*?]]' % ur'|'.join(site.namespace(14, all=True))), + #files + 'file': re.compile(ur'[[ *(?:%s)\s*:.*?]]' % ur'|'.join(site.namespace(6, all=True))),
}
@@ -219,10 +223,10 @@ groupMatch = groupR.search(replacement) if not groupMatch: break - groupID = (groupMatch.group('name') or \ + groupID = (groupMatch.group('name') or int(groupMatch.group('number'))) try: - replacement = (replacement[:groupMatch.start()] + \ + replacement = (replacement[:groupMatch.start()] + match.group(groupID) + \ replacement[groupMatch.end():]) except IndexError:
pywikibot-commits@lists.wikimedia.org