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

Change subject: Replace cosmetic change 'validXhtml' with 'HTML' fix
......................................................................


Replace cosmetic change 'validXhtml' with 'HTML' fix

MediaWiki 1.16+ $wgWellFormedXml defaults to converting <br> to <br/>
when rendering, making this cosmetic change unnecessary, and undesirable
to be performing it in every save operation.

Re-adding it as part of the 'HTML' fix which can be applied as desired,
e.g. versions prior to 1.16, cleaning the underlying wikitext.  It was
disabled from the HTML fix in compat dcf27d0c:
    https://www.mediawiki.org/wiki/Special:Code/pywikipedia/991

Bug: 55236
Change-Id: I27789904778c6d86dc6897d88215939f22fe68ca
---
M pywikibot/fixes.py
M scripts/cosmetic_changes.py
2 files changed, 2 insertions(+), 8 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, but someone else must approve
  Nullzero: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/fixes.py b/pywikibot/fixes.py
index a59f110..5a7f09e 100644
--- a/pywikibot/fixes.py
+++ b/pywikibot/fixes.py
@@ -68,9 +68,9 @@
             # Keep in mind that MediaWiki automatically converts <br> to <br />
             # when rendering pages, so you might comment the next two lines out
             # to save some time/edits.
-            #   (r'(?i)<br>',                      r'<br />'),
+            (r'(?i)<br *>',                      r'<br />'),
             # linebreak with attributes
-            #   (r'(?i)<br ([^>/]+?)>',            r'<br \1 />'),
+            (r'(?i)<br ([^>/]+?)>',            r'<br \1 />'),
             (r'(?i)<b>(.*?)</b>',              r"'''\1'''"),
             (r'(?i)<strong>(.*?)</strong>',    r"'''\1'''"),
             (r'(?i)<i>(.*?)</i>',              r"''\1''"),
diff --git a/scripts/cosmetic_changes.py b/scripts/cosmetic_changes.py
index e9437a1..f1f1c2c 100755
--- a/scripts/cosmetic_changes.py
+++ b/scripts/cosmetic_changes.py
@@ -184,7 +184,6 @@
 # FIXME:    self.translateMagicWords,
             self.replaceDeprecatedTemplates,
 # FIXME:    self.resolveHtmlEntities,
-            self.validXhtml,
             self.removeUselessSpaces,
             self.removeNonBreakingSpaceBeforePercent,
 
@@ -576,11 +575,6 @@
         if self.template:
             ignore += [58]
         text = pywikibot.html2unicode(text, ignore=ignore)
-        return text
-
-    def validXhtml(self, text):
-        text = textlib.replaceExcept(text, r'(?i)<br[ /]*>', r'<br />',
-                                     ['comment', 'math', 'nowiki', 'pre'])
         return text
 
     def removeUselessSpaces(self, text):

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I27789904778c6d86dc6897d88215939f22fe68ca
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Nullzero <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to