jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/313790 )
Change subject: [fixes] Remove <nowiki /> tags arround ISBN numbers
......................................................................
[fixes] Remove <nowiki /> tags arround ISBN numbers
- add a generator for the <nowiki /> tags which could be overwriten by any
generator option given to replace.py
- also simplify regex groups and fix multiple spaces between ISBN and number
Bug: T147180
Change-Id: Ie5942addaee800686cf87ea7c4e57ff68a37ab27
---
M pywikibot/fixes.py
1 file changed, 11 insertions(+), 6 deletions(-)
Approvals:
Huji: Looks good to me, approved
jenkins-bot: Verified
Zoranzoki21: Looks good to me, but someone else must approve
diff --git a/pywikibot/fixes.py b/pywikibot/fixes.py
index 6586cf4..ae5ed7d 100644
--- a/pywikibot/fixes.py
+++ b/pywikibot/fixes.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""File containing all standard fixes."""
#
-# (C) Pywikibot team, 2008-2010
+# (C) Pywikibot team, 2008-2017
#
# Distributed under the terms of the MIT license.
#
@@ -380,13 +380,15 @@
},
'isbn': {
+ 'generator': ['-search:insource:/nowiki\>ISBN:?(?: |
*)[0-9]/',
+ '-namespace:0'],
'regex': True,
'msg': 'isbn-formatting', # use i18n translations
'replacements': [
# Remove colon between the word ISBN and the number
(r'ISBN: (\d+)', r'ISBN \1'),
# superfluous word "number"
- (r'ISBN( number| no\.?| No\.?|-Nummer|-Nr\.):? (\d+)', r'ISBN
\2'),
+ (r'ISBN(?: [Nn]umber| [Nn]o\.?|-Nummer|-Nr\.):? (\d+)', r'ISBN
\1'),
# Space, minus, dot, hypen, en dash, em dash, etc. instead of
# hyphen-minus as separator, or spaces between digits and separators.
# Note that these regular expressions also match valid ISBNs, but
@@ -402,8 +404,11 @@
(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,
- # or non-breaking space.
- (r'ISBN(| | )((\d(-?)){12}\d|(\d(-?)){9}[\dXx])', r'ISBN
\2'),
+ # or multiple spaces or non-breaking space.
+ (r'ISBN(?: *| )((\d(-?)){12}\d|(\d(-?)){9}[\dXx])',
+ r'ISBN \1'),
+ # remove <nowiki /> tags
+ (r'<nowiki>ISBN ([0-9\-xX]+)</nowiki>', r'ISBN
\1'),
],
'exceptions': {
'inside-tags': [
@@ -411,8 +416,8 @@
'hyperlink',
],
'inside': [
- r'ISBN (\d(-?)){12}\d', # matches valid ISBN-13s
- r'ISBN (\d(-?)){9}[\dXx]', # matches valid ISBN-10s
+ r'ISBN (97[89]-?)(\d-?){9}\d', # matches valid ISBN-13s
+ r'ISBN (\d-?){9}[\dXx]', # matches valid ISBN-10s
],
}
},
--
To view, visit
https://gerrit.wikimedia.org/r/313790
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie5942addaee800686cf87ea7c4e57ff68a37ab27
Gerrit-PatchSet: 9
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Whym <whym(a)whym.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <dori.gord(a)orion.rs>
Gerrit-Reviewer: jenkins-bot <>