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

nicdumz at svn.wikimedia.org nicdumz at svn.wikimedia.org
Sun May 18 10:53:08 UTC 2008


Revision: 5395
Author:   nicdumz
Date:     2008-05-18 10:53:07 +0000 (Sun, 18 May 2008)

Log Message:
-----------
making replaceCategoryInPlace and removeCategoryLinks category regexes case insensitive

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

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2008-05-18 10:42:14 UTC (rev 5394)
+++ trunk/pywikipedia/wikipedia.py	2008-05-18 10:53:07 UTC (rev 5395)
@@ -3388,7 +3388,7 @@
     # NOTE: This assumes that language codes only consist of non-capital
     # ASCII letters and hyphens.
     catNamespace = '|'.join(site.category_namespaces())
-    categoryR = re.compile(r'\[\[\s*(%s)\s*:.*?\]\][\s]*' % catNamespace)
+    categoryR = re.compile(r'\[\[\s*(%s)\s*:.*?\]\][\s]*' % catNamespace, re.I)
     text = replaceExcept(text, categoryR, '', ['nowiki', 'comment', 'math', 'pre', 'source'], marker = marker)
     return text.strip()
 
@@ -3412,7 +3412,7 @@
     # spaces and underscores in page titles are interchangeable, and collapsible
     title = title.replace(r"\ ", "[ _]+").replace(r"\_", "[ _]+")
     categoryR = re.compile(r'\[\[\s*(%s)\s*:\s*%s\s*((?:\|[^]]+)?\]\])'
-                            % (catNamespace, title))
+                            % (catNamespace, title), re.I)
     if newcat is None:
         text = replaceExcept(oldtext, categoryR, '',
                              ['nowiki', 'comment', 'math', 'pre', 'source'])





More information about the Pywikipedia-l mailing list