From 780eff8da38000707f59ea7e1233ba25f0494d61 Mon Sep 17 00:00:00 2001 From: Arlo Breault Date: Wed, 7 Mar 2018 15:04:33 -0500 Subject: [PATCH] Parse wikitext in gallery caption Bug: T187958 Change-Id: Ibf1420e4d7fdbfd61dd7c9fdcfda2c73d5170c30 --- includes/parser/Parser.php | 7 ++++--- tests/parser/parserTests.txt | 27 +++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 5 deletions(-) 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 -- 2.20.1