Revision: 8307
Author: xqt
Date: 2010-06-18 15:52:34 +0000 (Fri, 18 Jun 2010)
Log Message:
-----------
fix for replaceExcept() with exceptionRegexes['template'] because a infinite loop
occures by some maths expression even they are excluded by 'math'. Example:
<math>\mathrm{{}^{9}_4 Be + {}^{4}_2 \alpha \to {}^{1}{}^{2}_6 C + {}^{1}_0 n
}</math>
Modified Paths:
--------------
branches/rewrite/pywikibot/textlib.py
trunk/pywikipedia/pywikibot/textlib.py
Modified: branches/rewrite/pywikibot/textlib.py
===================================================================
--- branches/rewrite/pywikibot/textlib.py 2010-06-18 10:55:33 UTC (rev 8306)
+++ branches/rewrite/pywikibot/textlib.py 2010-06-18 15:52:34 UTC (rev 8307)
@@ -80,7 +80,7 @@
# templates cascaded up to level 2, but no deeper. For arbitrary
# depth, we'd need recursion which can't be done in Python's re.
# After all, the language of correct parenthesis words is not regular.
- 'template': re.compile(r'(?s){{(({{.*?}})?.*?)*}}'),
+ 'template': re.compile(r'(?s){{(({{.*?}})|.)*}}'),
'hyperlink': compileLinkR(),
'gallery':
re.compile(r'(?is)<gallery.*?>.*?</gallery>'),
# this matches internal wikilinks, but also interwiki, categories, and
Modified: trunk/pywikipedia/pywikibot/textlib.py
===================================================================
--- trunk/pywikipedia/pywikibot/textlib.py 2010-06-18 10:55:33 UTC (rev 8306)
+++ trunk/pywikipedia/pywikibot/textlib.py 2010-06-18 15:52:34 UTC (rev 8307)
@@ -80,7 +80,7 @@
# templates cascaded up to level 2, but no deeper. For arbitrary
# depth, we'd need recursion which can't be done in Python's re.
# After all, the language of correct parenthesis words is not regular.
- 'template': re.compile(r'(?s){{(({{.*?}})?.*?)*}}'),
+ 'template': re.compile(r'(?s){{(({{.*?}})|.)*}}'),
'hyperlink': compileLinkR(),
'gallery':
re.compile(r'(?is)<gallery.*?>.*?</gallery>'),
# this matches internal wikilinks, but also interwiki, categories, and
Show replies by date