From: Arlo Breault Date: Wed, 7 Mar 2018 20:04:33 +0000 (-0500) Subject: Parse wikitext in gallery caption X-Git-Tag: 1.34.0-rc.0~3430^2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=780eff8da38000707f59ea7e1233ba25f0494d61;p=lhc%2Fweb%2Fwiklou.git Parse wikitext in gallery caption Bug: T187958 Change-Id: Ibf1420e4d7fdbfd61dd7c9fdcfda2c73d5170c30 --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 8e5dcbdab1..1248be3992 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4958,9 +4958,10 @@ class Parser { $ig->setShowFilename( false ); } if ( isset( $params['caption'] ) ) { - $caption = $params['caption']; - $caption = htmlspecialchars( $caption ); - $caption = $this->replaceInternalLinks( $caption ); + // NOTE: We aren't passing a frame here or below. Frame info + // is currently opaque to Parsoid, which acts on OT_PREPROCESS. + // See T107332#4030581 + $caption = $this->recursiveTagParse( $params['caption'] ); $ig->setCaptionHtml( $caption ); } if ( isset( $params['perrow'] ) ) { diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 6da23e1c46..df4f6aaa8d 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -20487,7 +20487,6 @@ image:foobar.jpg|link=Main Page#section|caption !! end -## Whoops, Parsoid shouldn't be parsing templates in the attribute caption! !! test Gallery with template inside caption !! options @@ -20500,7 +20499,7 @@ File:Foobar.jpg|{{echo|ho}} !! html/php !! end +!! test +Gallery with wikitext inside gallery caption +!! wikitext + +File:Foobar.jpg|Image caption + +!! html/php + + +!! end + !! test Gallery with wikitext inside caption !! options