Revision: 5203 Author: btongminh Date: 2008-04-11 13:36:23 +0000 (Fri, 11 Apr 2008)
Log Message: ----------- Limit complex replacement to filenames at the start of the template parameter
Modified Paths: -------------- trunk/pywikipedia/commonsdelinker/delinker.py
Modified: trunk/pywikipedia/commonsdelinker/delinker.py =================================================================== --- trunk/pywikipedia/commonsdelinker/delinker.py 2008-04-09 21:05:03 UTC (rev 5202) +++ trunk/pywikipedia/commonsdelinker/delinker.py 2008-04-11 13:36:23 UTC (rev 5203) @@ -267,7 +267,7 @@ # likely embedded in a complicated template. hook = 'complex' r_templates = ur'(?s)({{.*?}})' - r_complicated = u'(?s)((?:%s)?)%s' % (r_namespace, r_image) + r_complicated = u'(?s)[|{=]\s*((?:%s)?)%s' % (r_namespace, r_image) def template_replacer(match): return re.sub(r_complicated, simple_replacer, match.group(1))
pywikipedia-l@lists.wikimedia.org