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

Change subject: Do only replace the first occurrence of redirects.
......................................................................


Do only replace the first occurrence of redirects.

The first occurrence of the redirect tag is the mw redirect token
and will be changed by the bot.
All the others may be prosa and kept unchanged.

This PS do not change redirects inside comments anymore;
see 
https://en.wikipedia.org/wiki/Special:PermanentLink/619532917#Bot_messed_up_HTML_comments_while_fixing_double_redirect

Change-Id: I456b1e6635570e2cf0e5892558b19dede060b35e
---
M scripts/redirect.py
1 file changed, 3 insertions(+), 4 deletions(-)

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



diff --git a/scripts/redirect.py b/scripts/redirect.py
index 51d559c..6a99232 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -61,7 +61,7 @@
 #
 # (C) Daniel Herding, 2004.
 # (C) Purodha Blissenbach, 2009.
-# (C) xqt, 2009-2013
+# (C) xqt, 2009-2014
 # (C) Pywikibot team, 2004-2013
 #
 # Distributed under the terms of the MIT license.
@@ -72,8 +72,7 @@
 import re
 import datetime
 import pywikibot
-from pywikibot import i18n
-from pywikibot import xmlreader
+from pywikibot import i18n, xmlreader
 
 
 class RedirectGenerator:
@@ -671,7 +670,7 @@
             text = self.site.redirectRegex().sub(
                 '#%s %s' % (self.site.redirect(True),
                             targetlink),
-                oldText)
+                oldText, 1)
             if redir.title() == targetPage.title() or text == oldText:
                 pywikibot.output(u"Note: Nothing left to do on %s"
                                  % redir.title(asLink=True))

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I456b1e6635570e2cf0e5892558b19dede060b35e
Gerrit-PatchSet: 5
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Ricordisamoa <[email protected]>
Gerrit-Reviewer: Russell Blau <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to