From: Aryeh Gregor
Date: Wed, 24 Mar 2010 13:42:37 +0000 (+0000)
Subject: Correctly handle followed by ISBN
X-Git-Tag: 1.31.0-rc.0~37372
X-Git-Url: http://git.cyclocoop.org/data/Luca_Pacioli_%28Gemaelde%29.jpeg?a=commitdiff_plain;h=759db54cc2972f131d7673c833df80694f8baf5b;p=lhc%2Fweb%2Fwiklou.git
Correctly handle followed by ISBN
Bug 22905. Patch based on one submitted by Solitarius. Basically, we
were assuming that anything matching was a link and ignoring
it so as to avoid nested links, but that matched the HTML from
(fr) ISBN 2753300917 [http://www.example.com example.com]
so the ISBN didn't work. Parser test committed, fails without the
Parser.php change.
---
diff --git a/CREDITS b/CREDITS
index a07930a919..a4c38ad2dd 100644
--- a/CREDITS
+++ b/CREDITS
@@ -115,6 +115,7 @@ following names for their contribution to the product.
* ST47
* Scott Colcord
* Simon Walker
+* Solitarius
* Stefano Codari
* Str4nd
* svip
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index dc456145b5..f3a1ec6416 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -55,6 +55,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
* (bug 18664) Relative URIs in interwiki links cause failed redirects
* (bug 19270) Relative URIs in interwiki links break interwiki transclusion
* (bug 22903) Revdelete log entries now show in the user preferred language.
+* (bug 22905) Correctly handle followed by ISBN
== API changes in 1.17 ==
* (bug 22738) Allow filtering by action type on query=logevent
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 9260a8061f..3b6d6134ac 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -970,7 +970,7 @@ class Parser
$urlChar = self::EXT_LINK_URL_CLASS;
$text = preg_replace_callback(
'!(?: # Start cases
- () | # m[1]: Skip link text
+ (].*?) | # m[1]: Skip link text
(<.*?>) | # m[2]: Skip stuff inside HTML elements' . "
(\\b(?:$prots)$urlChar+) | # m[3]: Free external links" . '
(?:RFC|PMID)\s+([0-9]+) | # m[4]: RFC or PMID, capture number
diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt
index 544b1f69b5..aed2f053bd 100644
--- a/maintenance/parserTests.txt
+++ b/maintenance/parserTests.txt
@@ -6498,6 +6498,15 @@ ISBN ISBN 1234567890
!! end
+!! test
+Bug 22905: followed by ISBN followed by
+!! input
+(fr) ISBN 2753300917 [http://www.example.com example.com]
+!! result
+(fr) ISBN 2753300917 example.com
+
+!! end
+
!! test
Double RFC
!! input