jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/555693 )
Change subject: [FIX] replaceCategoryInPlace: Allow LRM and RLM at the end of the old_cat title ......................................................................
[FIX] replaceCategoryInPlace: Allow LRM and RLM at the end of the old_cat title
Left-to-right and right-to-left marks commonly occur at the end of the category name due to copy and pasting.
Bug: T240084 Change-Id: I6e3ef25c8a17ddb096a2d161019f7d891e3e0a1c --- M pywikibot/textlib.py 1 file changed, 4 insertions(+), 2 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index ebefc8f..4723749 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -1394,10 +1394,12 @@ title = '[%s%s]' % (title[0].upper(), title[0].lower()) + title[1:] # spaces and underscores in page titles are interchangeable and collapsible title = title.replace(r'\ ', '[ _]+').replace(r'_', '[ _]+') - categoryR = re.compile(r'[[\s*(%s)\s*:\s*%s\s*((?:|[^]]+)?]])' + categoryR = re.compile(r'[[\s*(%s)\s*:\s*%s[\s\u200e\u200f]*' + r'((?:|[^]]+)?]])' % (catNamespace, title), re.I) categoryRN = re.compile( - r'^[^\S\n]*[[\s*(%s)\s*:\s*%s\s*((?:|[^]]+)?]])[^\S\n]*\n' + r'^[^\S\n]*[[\s*(%s)\s*:\s*%s[\s\u200e\u200f]*' + r'((?:|[^]]+)?]])[^\S\n]*\n' % (catNamespace, title), re.I | re.M) exceptions = ['nowiki', 'comment', 'math', 'pre', 'source'] if newcat is None: