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):