* "== Header ==".
*/
public function guessSectionNameFromWikiText( $text ) {
+ global $wgEnforceHtmlIds;
# Strip out wikitext links(they break the anchor)
$text = $this->stripSectionName( $text );
- $headline = Sanitizer::decodeCharReferences( $text );
- # strip out HTML
- $headline = StringUtils::delimiterReplace( '<', '>', '', $headline );
- $headline = trim( $headline );
- $sectionanchor = '#' . urlencode( str_replace( ' ', '_', $headline ) );
- $replacearray = array(
- '%3A' => ':',
- '%' => '.'
- );
- return str_replace(
- array_keys( $replacearray ),
- array_values( $replacearray ),
- $sectionanchor );
+ return '#' . Sanitizer::escapeId( $text,
+ $wgEnforceHtmlIds ? array() : 'xml' );
}
/**