Revision: 6875
Author:   nicdumz
Date:     2009-05-12 09:51:06 +0000 (Tue, 12 May 2009)

Log Message:
-----------
templateswithParams: parser functions should not be excluded in the regex.

To match {{template| {{#if: .... }} }}, the inner if has to be matched first,
and then removed, to be able to match the outer template.
This fixes second part of bug #2788226

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

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py      2009-05-12 09:41:35 UTC (rev 6874)
+++ trunk/pywikipedia/wikipedia.py      2009-05-12 09:51:06 UTC (rev 6875)
@@ -1909,7 +1909,7 @@
         inside = {}
         count = 0
         Rtemplate = re.compile(
-                    
ur'{{(msg:)?(?!#)(?P<name>[^{\|]+?)(\|(?P<params>[^{]+?))?}}')
+                    ur'{{(msg:)?(?P<name>[^{\|]+?)(\|(?P<params>[^{]+?))?}}')
         Rlink = re.compile(ur'\[\[[^\]]+\]\]')
         Rmath = re.compile(ur'<math>[^<]+</math>')
         Rmarker = re.compile(ur'%s(\d+)%s' % (marker, marker))
@@ -1949,8 +1949,8 @@
                 if self.site().isInterwikiLink(name):
                     continue
 
-                # {{DEFAULTSORT:...}}
-                if name.startswith('DEFAULTSORT:'):
+                # {{DEFAULTSORT:...}} or {{#if: }}
+                if name.startswith('DEFAULTSORT:') or name.startswith('#'):
                     continue
 
                 try:



_______________________________________________
Pywikipedia-svn mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn

Reply via email to