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:

--
To view, visit https://gerrit.wikimedia.org/r/555693
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/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 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: DannyS712 <[email protected]>
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to