jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[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(-)

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:

To view, visit change 555693. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I6e3ef25c8a17ddb096a2d161019f7d891e3e0a1c
Gerrit-Change-Number: 555693
Gerrit-PatchSet: 3
Gerrit-Owner: JJMC89 <JJMC89.Wikimedia@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: DannyS712 <DannyS712.enwiki@gmail.com>