From d7d8458bc0c0ffd2b93fcda35810809e83c1a26d Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Mon, 23 Jun 2014 17:45:41 -0300 Subject: [PATCH] Allow fragments in link= parameter in tags. This brings the image syntax in gallery tags inline with normal syntax. Handle File:foo.png|link=bar#baz properly. Bug: 62343 Change-Id: If6149ccc19f70605ad4481e4da2ca55676d6001d --- includes/parser/Parser.php | 2 +- tests/parser/parserTests.txt | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 236b999eb3..61fd9cc2dd 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -5339,7 +5339,7 @@ class Parser { } else { $localLinkTitle = Title::newFromText( $linkValue ); if ( $localLinkTitle !== null ) { - $link = $localLinkTitle->getLocalURL(); + $link = $localLinkTitle->getLinkURL(); } } break; diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index c447a44c53..b3e9c511fd 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -15134,6 +15134,37 @@ image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla. !! end +!! test +Gallery with link that has fragment +!! wikitext + +image:foobar.jpg|link=Main_Page +image:foobar.jpg|link=Main_Page#section +image:foobar.jpg|link=Main Page#section|caption + +!! html + + +!! end + !! test Gallery with wikitext inside caption !! wikitext -- 2.20.1