Revision: 4076 Author: wikipedian Date: 2007-08-19 13:25:51 +0000 (Sun, 19 Aug 2007)
Log Message: ----------- bugfix: displaying context when the link is near the beginning of the article
Modified Paths: -------------- trunk/pywikipedia/selflink.py
Modified: trunk/pywikipedia/selflink.py =================================================================== --- trunk/pywikipedia/selflink.py 2007-08-19 13:22:49 UTC (rev 4075) +++ trunk/pywikipedia/selflink.py 2007-08-19 13:25:51 UTC (rev 4076) @@ -108,7 +108,7 @@ else: # at the beginning of the link, start red color. # at the end of the link, reset the color to default - wikipedia.output(text[match.start() - context) : match.start()] + '\03{lightred}' + text[match.start() : match.end()] + '\03{default}' + text[match.end() : match.end() + context]) + wikipedia.output(text[max(0, match.start() - context) : match.start()] + '\03{lightred}' + text[match.start() : match.end()] + '\03{default}' + text[match.end() : match.end() + context]) choice = wikipedia.inputChoice(u'\nWhat shall be done with this selflink?', ['unlink', 'make bold', 'skip', 'edit', 'more context'], ['U', 'b', 's', 'e', 'm'], 'u') wikipedia.output(u'')