Revision: 7594 Author: xqt Date: 2009-11-05 14:41:45 +0000 (Thu, 05 Nov 2009)
Log Message: ----------- actualized from trunk
Modified Paths: -------------- branches/rewrite/scripts/cosmetic_changes.py
Modified: branches/rewrite/scripts/cosmetic_changes.py =================================================================== --- branches/rewrite/scripts/cosmetic_changes.py 2009-11-05 07:19:10 UTC (rev 7593) +++ branches/rewrite/scripts/cosmetic_changes.py 2009-11-05 14:41:45 UTC (rev 7594) @@ -93,6 +93,7 @@ 'sr': u'Бот козметичке промене', 'sv': u'Bot: Kosmetiska ändringar', 'th': u'บอต ปรับแต่งให้อ่านง่าย', + 'tk': u'Bot: kosmetik üýtgeşme', 'tl': u'robot Kosmetiko pagbabago', 'tr': u'Bot Kozmetik değişiklikler', 'uk': u'робот косметичні зміни', @@ -149,6 +150,7 @@ 'sr': u'; козметичке промене', 'sv': u'; kosmetiska ändringar', 'th': u'; ปรับแต่งให้อ่านง่าย', + 'tk': u'; kosmetik üýtgeşme', 'tl': u'; Kosmetiko pagbabago', 'tr': u'; Kozmetik değişiklikler', 'uk': u'; косметичні зміни', @@ -159,7 +161,7 @@ }
class CosmeticChangesToolkit: - def __init__(self, site, debug = False, redirect = False, namespace = None): + def __init__(self, site, debug=False, redirect=False, namespace=None): self.site = site self.debug = debug self.redirect = redirect @@ -169,7 +171,7 @@
def change(self, text): """ - Given a wiki source code text, returns the cleaned up version. + Given a wiki source code text, return the cleaned up version. """ oldText = text text = self.fixSelfInterwiki(text) @@ -337,6 +339,8 @@ newLink = ' ' + newLink if hadTrailingSpaces: newLink = newLink + ' ' + if newline: + newLink = newline + newLink return newLink # don't change anything return match.group() @@ -370,7 +374,7 @@ return text
def validXhtml(self, text): - text = pywikibot.replaceExcept(text, r'<br>', r'<br />', ['comment', 'math', 'nowiki', 'pre']) + text = pywikibot.replaceExcept(text, r'(?i)<br[ /]*>', r'<br />', ['comment', 'math', 'nowiki', 'pre']) return text
def removeUselessSpaces(self, text):
pywikipedia-svn@lists.wikimedia.org