[Pywikipedia-l] SVN: [4764] trunk/pywikipedia/wikipedia.py

rotem at svn.wikimedia.org rotem at svn.wikimedia.org
Thu Dec 27 18:50:16 UTC 2007


Revision: 4764
Author:   rotem
Date:     2007-12-27 18:50:16 +0000 (Thu, 27 Dec 2007)

Log Message:
-----------
Making sure markers don't contain other markers.

Modified Paths:
--------------
    trunk/pywikipedia/wikipedia.py

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2007-12-27 18:41:24 UTC (rev 4763)
+++ trunk/pywikipedia/wikipedia.py	2007-12-27 18:50:16 UTC (rev 4764)
@@ -1561,8 +1561,11 @@
                 # Make sure it is not detected again
                 count += 1
                 text = m.group()
+                thistxt = thistxt.replace(text, '%s%d%s' % (marker, count, marker))
+                for m2 in Rmarker.finditer(text):
+                    # Make sure markers don't contain other markers
+                    text = text.replace(m2.group(), markers[int(m2.group(1))])
                 markers[count] = text
-                thistxt = thistxt.replace(text, '%s%d%s' % (marker, count, marker))
 
                 # Name
                 name = m.group('name')





More information about the Pywikipedia-l mailing list