[Pywikipedia-l] SVN: [6225] trunk/pywikipedia/fixes.py

wikipedian at svn.wikimedia.org wikipedian at svn.wikimedia.org
Mon Jan 5 19:28:01 UTC 2009


Revision: 6225
Author:   wikipedian
Date:     2009-01-05 19:28:01 +0000 (Mon, 05 Jan 2009)

Log Message:
-----------
isbn: fix things like ISBN1234567890

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

Modified: trunk/pywikipedia/fixes.py
===================================================================
--- trunk/pywikipedia/fixes.py	2009-01-05 19:27:29 UTC (rev 6224)
+++ trunk/pywikipedia/fixes.py	2009-01-05 19:28:01 UTC (rev 6225)
@@ -392,12 +392,15 @@
             # or spaces between digits and separators.
             # Note that these regular expressions also match valid ISBNs, but
             # these won't be changed.
-            (ur'ISBN (978|979) *[\- –\.] *(\d+) *[\- –\.] *(\d+) *[\- –\.] *(\d+) *[\- –\.] *(\d)(?!\d)', r'ISBN \1-\2-\3-\4-\5'), # ISBN13
-            (ur'ISBN (\d+) *[\- –\.] *(\d+) *[\- –\.] *(\d+) *[\- –\.] *(\d|X|x)(?!\d)', r'ISBN \1-\2-\3-\4'), # ISBN10
+            (r'ISBN (978|979) *[\- –\.] *(\d+) *[\- –\.] *(\d+) *[\- –\.] *(\d+) *[\- –\.] *(\d)(?!\d)', r'ISBN \1-\2-\3-\4-\5'), # ISBN-13
+            (r'ISBN (\d+) *[\- –\.] *(\d+) *[\- –\.] *(\d+) *[\- –\.] *(\d|X|x)(?!\d)', r'ISBN \1-\2-\3-\4'), # ISBN-10
+            # missing space before ISBN-10 or before ISBN-13
+            (r'ISBN((\d(-?)){12}\d|(\d(-?)){9}[\dXx])', r'ISBN \1'),
         ],
         'exceptions': {
             'inside-tags': [
                 'comment',
+                'hyperlink',
             ],
             'inside': [
                 r'ISBN (\d(-?)){12}\d',    # matches valid ISBN-13s





More information about the Pywikipedia-l mailing list