Revision: 5856 Author: nicdumz Date: 2008-08-28 06:05:23 +0000 (Thu, 28 Aug 2008)
Log Message: ----------- Committing fix by Jeremy Baron for bug #2079760 [Periods converted to percent signs in section links]
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-08-27 22:06:03 UTC (rev 5855) +++ trunk/pywikipedia/wikipedia.py 2008-08-28 06:05:23 UTC (rev 5856) @@ -228,6 +228,8 @@ Rwatchlist = re.compile(r"<input tabindex='[\d]+' type='checkbox' " r"name='wpWatchthis' checked='checked'") Rlink = re.compile(r'[[(?P<title>[^]|[]*)(|[^]]*)?]]') +resectiondecodeescapes = re.compile(r".(?=[0-9a-f]{2})",re.I) +resectiondecodeleadingnonalpha = re.compile(r'^x(?=[^a-zA-Z])')
class Page(object): @@ -526,7 +528,8 @@ """ section = self._section if section and decode: - section = section.replace('.', '%') + section = resectiondecodeleadingnonalpha.sub('',section) + section = resectiondecodeescapes.sub('%',section) section = url2unicode(section, self._site) if not underscore: section = section.replace('_', ' ')