Revision: 7931 Author: xqt Date: 2010-02-15 06:41:03 +0000 (Mon, 15 Feb 2010)
Log Message: ----------- do not change arabic digits inside file links for ckb-wiki arz-wiki uses english namespaces, not the arabic localisation
Modified Paths: -------------- trunk/pywikipedia/cosmetic_changes.py
Modified: trunk/pywikipedia/cosmetic_changes.py =================================================================== --- trunk/pywikipedia/cosmetic_changes.py 2010-02-14 19:54:38 UTC (rev 7930) +++ trunk/pywikipedia/cosmetic_changes.py 2010-02-15 06:41:03 UTC (rev 7931) @@ -405,6 +405,9 @@ """ Makes sure that localized namespace names are used. """ + # arz uses english stylish codes + if self.site.sitename() == 'wikipedia:arz' + return text family = self.site.family # wiki links aren't parsed here. exceptions = ['nowiki', 'comment', 'math', 'pre'] @@ -712,6 +715,9 @@ # do not change digits inside html-tags pattern = re.compile(u'<[/]*?[^</]+?[/]*?>', re.UNICODE) exceptions.append(pattern) + # do not change digits inside file links + pattern = re.compile(u'[[.+?:.+?..+?|.+?]]', re.UNICODE) + exceptions.append(pattern) for i in range(0,10): text = pywikibot.replaceExcept(text, str(i), u'٠١٢٣٤٥٦٧٨٩'[i], exceptions) return text