r64113 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64112‎ | r64113 | r64114 >
Date:13:42, 24 March 2010
Author:simetrical
Status:ok
Tags:
Comment:
Correctly handle <abbr> followed by ISBN

Bug 22905. Patch based on one submitted by Solitarius. Basically, we
were assuming that anything matching <a.*?</a> was a link and ignoring
it so as to avoid nested links, but that matched the HTML from

<abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]

so the ISBN didn't work. Parser test committed, fails without the
Parser.php change.
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/maintenance/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.txt
@@ -6499,6 +6499,15 @@
65006500 !! end
65016501
65026502 !! test
 6503+Bug 22905: <abbr> followed by ISBN followed by </a>
 6504+!! input
 6505+<abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
 6506+!! result
 6507+<p><abbr>(fr)</abbr> <a href="https://www.mediawiki.org/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a href="http://www.example.com" class="external text" rel="nofollow">example.com</a>
 6508+</p>
 6509+!! end
 6510+
 6511+!! test
65036512 Double RFC
65046513 !! input
65056514 RFC RFC 1234
Index: trunk/phase3/CREDITS
@@ -115,6 +115,7 @@
116116 * ST47
117117 * Scott Colcord
118118 * Simon Walker
 119+* Solitarius
119120 * Stefano Codari
120121 * Str4nd
121122 * svip
Index: trunk/phase3/includes/parser/Parser.php
@@ -970,7 +970,7 @@
971971 $urlChar = self::EXT_LINK_URL_CLASS;
972972 $text = preg_replace_callback(
973973 '!(?: # Start cases
974 - (<a.*?</a>) | # m[1]: Skip link text
 974+ (<a[ \t\r\n>].*?</a>) | # m[1]: Skip link text
975975 (<.*?>) | # m[2]: Skip stuff inside HTML elements' . "
976976 (\\b(?:$prots)$urlChar+) | # m[3]: Free external links" . '
977977 (?:RFC|PMID)\s+([0-9]+) | # m[4]: RFC or PMID, capture number
Index: trunk/phase3/RELEASE-NOTES
@@ -55,6 +55,7 @@
5656 * (bug 18664) Relative URIs in interwiki links cause failed redirects
5757 * (bug 19270) Relative URIs in interwiki links break interwiki transclusion
5858 * (bug 22903) Revdelete log entries now show in the user preferred language.
 59+* (bug 22905) Correctly handle <abbr> followed by ISBN
5960
6061 == API changes in 1.17 ==
6162 * (bug 22738) Allow filtering by action type on query=logevent

Follow-up revisions

RevisionCommit summaryAuthorDate
r65974MFT r64113, bug 22905: incorrect DML regex causing mishandling of <abbr>tstarling00:31, 6 May 2010

Status & tagging log