Dvorapa has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405539 )
Change subject: [bugfix][TEST] cc: Get cleanUpSectionHeaders working with tabs
......................................................................
[bugfix][TEST] cc: Get cleanUpSectionHeaders working with tabs
Bug: T185392
Change-Id: I0bafdf3db015d3bca7622219085307d524b51ee7
---
M pywikibot/cosmetic_changes.py
M tests/cosmetic_changes_tests.py
2 files changed, 4 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/39/405539/1
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 009eed5..d957dd4 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -649,7 +649,7 @@
return text
return textlib.replaceExcept(
text,
- r'(?m)^(={1,7}) *(?P<title>[^=]+?) *\1 *\r?\n',
+ r'(?m)^(={1,7}) *(?P<title>[^=]+?) *\1[ \t]*\r?\n',
r'\1 \g<title> \1%s' % config.LS,
['comment', 'math', 'nowiki', 'pre'])
diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py
index 6e22088..6474627 100644
--- a/tests/cosmetic_changes_tests.py
+++ b/tests/cosmetic_changes_tests.py
@@ -83,6 +83,9 @@
"""Test cleanUpSectionHeaders method."""
self.assertEqual('=== Header ===\n',
self.cct.cleanUpSectionHeaders('===Header===\n'))
+ # tab
+ self.assertEqual('=== Header ===\n',
+ self.cct.cleanUpSectionHeaders('===Header=== \n'))
def test_putSpacesInLists(self):
"""Test putSpacesInLists method."""
--
To view, visit https://gerrit.wikimedia.org/r/405539
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0bafdf3db015d3bca7622219085307d524b51ee7
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dvorapa <dvorapa@seznam.cz>
_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Change subject: [bugfix][TEST] cc: Get cleanUpSectionHeaders working with tabs
......................................................................
[bugfix][TEST] cc: Get cleanUpSectionHeaders working with tabs
Bug: T185392
Change-Id: I0bafdf3db015d3bca7622219085307d524b51ee7
---
M pywikibot/cosmetic_changes.py
M tests/cosmetic_changes_tests.py
2 files changed, 4 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/39/405539/1
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 009eed5..d957dd4 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -649,7 +649,7 @@
return text
return textlib.replaceExcept(
text,
- r'(?m)^(={1,7}) *(?P<title>[^=]+?) *\1 *\r?\n',
+ r'(?m)^(={1,7}) *(?P<title>[^=]+?) *\1[ \t]*\r?\n',
r'\1 \g<title> \1%s' % config.LS,
['comment', 'math', 'nowiki', 'pre'])
diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py
index 6e22088..6474627 100644
--- a/tests/cosmetic_changes_tests.py
+++ b/tests/cosmetic_changes_tests.py
@@ -83,6 +83,9 @@
"""Test cleanUpSectionHeaders method."""
self.assertEqual('=== Header ===\n',
self.cct.cleanUpSectionHeaders('===Header===\n'))
+ # tab
+ self.assertEqual('=== Header ===\n',
+ self.cct.cleanUpSectionHeaders('===Header=== \n'))
def test_putSpacesInLists(self):
"""Test putSpacesInLists method."""
--
To view, visit https://gerrit.wikimedia.org/r/405539
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0bafdf3db015d3bca7622219085307d524b51ee7
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dvorapa <dvorapa@seznam.cz>
_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits