Revision: 8748 Author: xqt Date: 2010-12-01 09:39:46 +0000 (Wed, 01 Dec 2010) Log Message: ----------- Don't change digits inside tables and styles. bugfix for r8678
Modified Paths: -------------- trunk/pywikipedia/cosmetic_changes.py
Modified: trunk/pywikipedia/cosmetic_changes.py =================================================================== --- trunk/pywikipedia/cosmetic_changes.py 2010-11-27 19:50:26 UTC (rev 8747) +++ trunk/pywikipedia/cosmetic_changes.py 2010-12-01 09:39:46 UTC (rev 8748) @@ -712,11 +712,14 @@ ] # do not change inside file links namespaces = list(self.site.namespace(6, all = True)) - pattern = re.compile(u'[[(' + '|'.join(namespaces) + '):.+?..+?]]', re.UNICODE) + pattern = re.compile(u'[[(' + '|'.join(namespaces) + '):.+?..+?]]', + re.UNICODE) exceptions.append(pattern) text = pywikibot.replaceExcept(text, u',', u'،', exceptions) if self.site.lang=='ckb': - text = pywikibot.replaceExcept(text, ur'ه([.،_<]\s])', ur'ە\1', exceptions) + text = pywikibot.replaceExcept(text, + ur'ه([.،_<]\s])', + ur'ە\1', exceptions) text = pywikibot.replaceExcept(text, u'ه', u'ە', exceptions) text = pywikibot.replaceExcept(text, u'ه', u'ھ', exceptions) text = pywikibot.replaceExcept(text, u'ك', u'ک', exceptions) @@ -724,10 +727,13 @@ # replace persian digits for i in range(0,10): if self.site.lang=='ckb': - text = pywikibot.replaceExcept(text, u'۰۱۲۳۴۵۶۷۸۹'[i], u'٠١٢٣٤٥٦٧٨٩'[i], exceptions) + text = pywikibot.replaceExcept(text, + u'۰۱۲۳۴۵۶۷۸۹'[i], + u'٠١٢٣٤٥٦٧٨٩'[i], exceptions) else: - text = pywikibot.replaceExcept(text, u'٠١٢٣٤٥٦٧٨٩'[i], u'۰۱۲۳۴۵۶۷۸۹'[i], exceptions) - text = pywikibot.replaceExcept(text, u'0123456789'[i], u'۰۱۲۳۴۵۶۷۸۹'[i], exceptions) + text = pywikibot.replaceExcept(text, + u'٠١٢٣٤٥٦٧٨٩'[i], + u'۰۱۲۳۴۵۶۷۸۹'[i], exceptions) # do not change digits in class, style and table params pattern = re.compile(u'=".*?"', re.UNICODE) exceptions.append(pattern) @@ -737,9 +743,11 @@ exceptions.append('table') #exclude tables for now for i in range(0,10): if self.site.lang=='ckb': - text = pywikibot.replaceExcept(text, str(i), u'٠١٢٣٤٥٦٧٨٩'[i], exceptions) + text = pywikibot.replaceExcept(text, str(i), + u'٠١٢٣٤٥٦٧٨٩'[i], exceptions) else: - text = pywikibot.replaceExcept(text, str(i), u'۰۱۲۳۴۵۶۷۸۹'[i], exceptions) + text = pywikibot.replaceExcept(text, str(i), + u'۰۱۲۳۴۵۶۷۸۹'[i], exceptions) return text
# Retrieved from "http://commons.wikimedia.org/wiki/Commons:Tools/pywiki_file_description_clea..."
pywikipedia-svn@lists.wikimedia.org