[Pywikipedia-l] SVN: [5956] trunk/pywikipedia/checkimages.py

filnik at svn.wikimedia.org filnik at svn.wikimedia.org
Sat Oct 11 14:07:55 UTC 2008


Revision: 5956
Author:   filnik
Date:     2008-10-11 14:07:54 +0000 (Sat, 11 Oct 2008)

Log Message:
-----------
Little bugfix

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

Modified: trunk/pywikipedia/checkimages.py
===================================================================
--- trunk/pywikipedia/checkimages.py	2008-10-10 21:20:05 UTC (rev 5955)
+++ trunk/pywikipedia/checkimages.py	2008-10-11 14:07:54 UTC (rev 5956)
@@ -1411,12 +1411,13 @@
             white_template_found = 0
             for l in hiddentemplate:
                 if tagged == False:
-                    res = re.findall(r'\{\{(?:[Tt]emplate:|)%s[ \n]*?(?:\n|\||\})' % l.lower(), g.lower())
+                    # why creator? Because on commons there's a template such as {{creator:name}} that.. works
+                    res = re.findall(r'\{\{(?:[Tt]emplate:|)%s(?:[ \n]*?(?:\n|\||\}|creator:))' % l.lower(), g.lower())
                     if res != []:
                         white_template_found += 1
                         if l != '' and l != ' ': # Check that l is not nothing or a space
                             # Deleting! (replace the template with nothing)
-                            regex_white_template = re.compile(r'\{\{(?:template:|)%s' % l, re.IGNORECASE)
+                            regex_white_template = re.compile(r'\{\{(?:template:|)(?:%s|creator)' % l, re.IGNORECASE)
                             g = regex_white_template.sub(r'', g)
                             hiddenTemplateFound = True
             if white_template_found == 1:





More information about the Pywikipedia-l mailing list