{{anchorencode:}} output should be always usable in links
Bug: T179544 Change-Id: If8098e3e839e8ba1cf27b6053017e818c556a733
This commit is contained in:
parent
962529515d
commit
f9d4f53105
2 changed files with 13 additions and 1 deletions
|
|
@ -930,7 +930,8 @@ class CoreParserFunctions {
|
|||
*/
|
||||
public static function anchorencode( $parser, $text ) {
|
||||
$text = $parser->killMarkers( $text );
|
||||
return (string)substr( $parser->guessSectionNameFromWikiText( $text ), 1 );
|
||||
$section = (string)substr( $parser->guessSectionNameFromWikiText( $text ), 1 );
|
||||
return Sanitizer::safeEncodeAttribute( $section );
|
||||
}
|
||||
|
||||
public static function special( $parser, $text ) {
|
||||
|
|
|
|||
|
|
@ -29729,3 +29729,14 @@ T72875: Test for brackets in attributes of elements in internal link texts
|
|||
<a href="/wiki/Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
|
||||
</p>
|
||||
!! end
|
||||
|
||||
!! test
|
||||
T179544: {{anchorencode:}} output should be always usable in links
|
||||
!! config
|
||||
wgFragmentMode=[ 'html5' ]
|
||||
!! wikitext
|
||||
<span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
|
||||
!! html/php
|
||||
<p><span id="[foo]"></span><a href="#[foo]">#[foo]</a>
|
||||
</p>
|
||||
!! end
|
||||
|
|
|
|||
Loading…
Reference in a new issue