jenkins-bot has submitted this change and it was merged.

Change subject: Fix self interwikis beginning with colon, too
......................................................................


Fix self interwikis beginning with colon, too

Change-Id: I212e953cf08ea822b0d5777d221028ad83da9f30
---
M pywikibot/cosmetic_changes.py
M tests/cosmetic_changes_tests.py
2 files changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Dalba: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 645b5e0..8405bec 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -288,7 +288,7 @@
         Remove their language code prefix.
         """
         if not self.talkpage and pywikibot.calledModuleName() != 'interwiki':
-            interwikiR = re.compile(r'\[\[%s\s?:([^\[\]\n]*)\]\]'
+            interwikiR = re.compile(r'\[\[(?: *:)? *%s *: *([^\[\]\n]*)\]\]'
                                     % self.site.code)
             text = interwikiR.sub(r'[[\1]]', text)
         return text
diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py
index ad795a0..081e6c1 100644
--- a/tests/cosmetic_changes_tests.py
+++ b/tests/cosmetic_changes_tests.py
@@ -39,6 +39,10 @@
         """Test fixSelfInterwiki method."""
         self.assertEqual('[[Foo bar]]',
                          self.cct.fixSelfInterwiki('[[de:Foo bar]]'))
+        self.assertEqual('[[Foo bar]]',
+                         self.cct.fixSelfInterwiki('[[:de: Foo bar]]'))
+        self.assertEqual('[[Foo bar|Bar baz]]',
+                         self.cct.fixSelfInterwiki('[[ de: Foo bar|Bar baz]]'))
         self.assertEqual('[[en:Foo bar]]',
                          self.cct.fixSelfInterwiki('[[en:Foo bar]]'))
 

-- 
To view, visit https://gerrit.wikimedia.org/r/318349
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I212e953cf08ea822b0d5777d221028ad83da9f30
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Matěj Suchánek <[email protected]>
Gerrit-Reviewer: Dalba <[email protected]>
Gerrit-Reviewer: Matěj Suchánek <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to