http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11678
Revision: 11678 Author: xqt Date: 2013-06-21 07:51:56 +0000 (Fri, 21 Jun 2013) Log Message: ----------- update from trunk r11677
Modified Paths: -------------- branches/rewrite/pywikibot/textlib.py
Modified: branches/rewrite/pywikibot/textlib.py =================================================================== --- branches/rewrite/pywikibot/textlib.py 2013-06-21 07:30:15 UTC (rev 11677) +++ branches/rewrite/pywikibot/textlib.py 2013-06-21 07:51:56 UTC (rev 11678) @@ -1060,6 +1060,7 @@ #----------------------------------
def does_text_contain_section(pagetext, section): + section = re.sub('[ _]', '[ _]', section) """Determines whether the page text contains the given section title.""" - m = re.search("=+[ ']*%s[ ']*=+" % re.escape(section), pagetext) + m = re.search("=+[ ']*%s[ ']*=+" % section, pagetext) return bool(m)