From 42e3ee23a090d41ecde539f4a2c90c1e151bc422 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 25 Mar 2008 00:46:37 +0000 Subject: [PATCH] (bug 13436) Treat image captions as image captions when they include option keywords (like ending with "px" or starting with "upright"), provided the non-keyword part of the caption is non-numeric. Patch based on suggestion by Mormegil, Soxred93. --- RELEASE-NOTES | 2 ++ includes/Parser.php | 4 +++- maintenance/parserTests.inc | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c78bef898a..2067c4eee9 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -130,6 +130,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 11325) Wrapped page titles in MonoBook skin spaced more nicely * (bug 12077) Fix HTML nesting for TOC * (bug 344) Purge cache for talk/article pages when deleting the other tab +* (bug 13436) Treat image captions correctly when they include option keywords + (like ending with "px" or starting with "upright") === API changes in 1.13 === diff --git a/includes/Parser.php b/includes/Parser.php index 64ebdc89b1..50324b9ddf 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -4416,7 +4416,9 @@ class Parser 'horizAlign' => array(), 'vertAlign' => array() ); foreach( $parts as $part ) { list( $magicName, $value ) = $mwArray->matchVariableStartToEnd( $part ); - if ( isset( $paramMap[$magicName] ) ) { + # (bug 13436) If $value is non-numeric, assume it's a caption + if( isset( $paramMap[$magicName] ) && + ( !$value || is_numeric($value) ) ) { list( $type, $paramName ) = $paramMap[$magicName]; $params[$type][$paramName] = $value; diff --git a/maintenance/parserTests.inc b/maintenance/parserTests.inc index 2e616a0a6b..680ca234b5 100644 --- a/maintenance/parserTests.inc +++ b/maintenance/parserTests.inc @@ -316,7 +316,7 @@ class ParserTest { } else if (preg_match('/\\bcat\\b/i', $opts)) { global $wgOut; $wgOut->addCategoryLinks($output->getCategories()); - $out = $this->tidy ( implode( ' ', $wgOut->getCategoryLinks() ) ); + $out = $this->tidy( implode( ' ', $wgOut->getCategoryLinks() ) ); } $result = $this->tidy($result); -- 2.20.1