Revision: 7934 Author: xqt Date: 2010-02-15 13:49:12 +0000 (Mon, 15 Feb 2010)
Log Message: ----------- cc: do not any changes inside file links
Modified Paths: -------------- trunk/pywikipedia/cosmetic_changes.py
Modified: trunk/pywikipedia/cosmetic_changes.py =================================================================== --- trunk/pywikipedia/cosmetic_changes.py 2010-02-15 13:46:26 UTC (rev 7933) +++ trunk/pywikipedia/cosmetic_changes.py 2010-02-15 13:49:12 UTC (rev 7934) @@ -700,6 +700,10 @@ 'source', 'startspace', ] + # do not change inside file links + namespaces = list(self.site.namespace(6, all = True)) + pattern = re.compile(u'[[(' + '|'.join(namespaces) + '):.+?..+?]]', re.UNICODE) + exceptions.append(pattern) text = pywikibot.replaceExcept(text, u',', u'،', exceptions) text = pywikibot.replaceExcept(text, ur'ه([.،_<]\s])', ur'ە\1', exceptions) text = pywikibot.replaceExcept(text, u'ه', u'ە', exceptions) @@ -715,9 +719,6 @@ # 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
pywikipedia-svn@lists.wikimedia.org