http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11089
Revision: 11089 Author: amir Date: 2013-02-20 08:43:44 +0000 (Wed, 20 Feb 2013) Log Message: ----------- fixing Persian comma problem (bug #3605068)
Modified Paths: -------------- trunk/pywikipedia/cosmetic_changes.py
Modified: trunk/pywikipedia/cosmetic_changes.py =================================================================== --- trunk/pywikipedia/cosmetic_changes.py 2013-02-19 20:11:53 UTC (rev 11088) +++ trunk/pywikipedia/cosmetic_changes.py 2013-02-20 08:43:44 UTC (rev 11089) @@ -732,12 +732,13 @@ new = digits.pop(self.site.lang) # This only works if there are only two items in digits dict old = digits[digits.keys()[0]] + faChrs = u'ءاآأإئؤبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیةيك' + u'ًٌٍَُِّْٓٔ'+u'۱۲۳۴۵۶۷۸۹۰' # do not change inside file links namespaces = list(self.site.namespace(6, all=True)) pattern = re.compile(u'[[(' + '|'.join(namespaces) + '):.+?.\w+? *(|(([[.*?]])|.)*)?]]', re.UNICODE) #not to let bot edits in latin content - exceptions.append(re.compile(u"[A-Za-z\d]+? *?"*? *?, *?[A-Za-z\d]+?")) + exceptions.append(re.compile(u"[^"+faChrs+u"]+? *?"*? *?, *?[^"+faChrs+u"]+?")) exceptions.append(pattern) text = pywikibot.replaceExcept(text, u',', u'،', exceptions) if self.site.lang=='ckb':
pywikipedia-svn@lists.wikimedia.org