Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/208914

Change subject: [bugfix] Check for invalid references tags
......................................................................

[bugfix] Check for invalid references tags

bug: T98115
Change-Id: I2fe3858fe036a0179c29c6746e1b10fa062cc00c
---
M scripts/noreferences.py
1 file changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/14/208914/1

diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index 24f3669..6c36bf1 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -34,7 +34,7 @@
 a list of affected articles
 """
 #
-# (C) Pywikibot team, 2007-2014
+# (C) Pywikibot team, 2007-2015
 #
 # Distributed under the terms of the MIT license.
 #
@@ -534,6 +534,16 @@
         * Returns : The modified pagetext
 
         """
+        # Do we have a malformed <reference> tag which could be repaired?
+        references2 = re.compile(u'(?sm)<\s*references\s*>(.*?)'
+                                 u'<\s*/?\s*references\s*/?\s*>', re.DOTALL)
+        references1 = re.compile(u'<\s*references\s*>')
+        if references2.search(oldText):
+            pywikibot.output(u'Repairing references tag')
+            return re.sub(references2, ur'<references>\1</references>', 
oldText)
+        if references1.search(oldText):
+            pywikibot.output(u'Repairing references tag')
+            return re.sub(references1, self.referencesText, oldText)
         # Is there an existing section where we can add the references tag?
         for section in i18n.translate(self.site, referencesSections):
             sectionR = re.compile(r'\r?\n=+ *%s *=+ *\r?\n' % section)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2fe3858fe036a0179c29c6746e1b10fa062cc00c
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <i...@gno.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to