Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -4736,11 +4736,21 @@ |
4737 | 4737 | * "== Header ==". |
4738 | 4738 | */ |
4739 | 4739 | public function guessSectionNameFromWikiText( $text ) { |
4740 | | - global $wgEnforceHtmlIds; |
4741 | 4740 | # Strip out wikitext links(they break the anchor) |
4742 | 4741 | $text = $this->stripSectionName( $text ); |
4743 | | - return '#' . Sanitizer::escapeId( $text, |
4744 | | - $wgEnforceHtmlIds ? 'noninitial' : 'xml' ); |
| 4742 | + $headline = Sanitizer::decodeCharReferences( $text ); |
| 4743 | + # strip out HTML |
| 4744 | + $headline = StringUtils::delimiterReplace( '<', '>', '', $headline ); |
| 4745 | + $headline = trim( $headline ); |
| 4746 | + $sectionanchor = '#' . urlencode( str_replace( ' ', '_', $headline ) ); |
| 4747 | + $replacearray = array( |
| 4748 | + '%3A' => ':', |
| 4749 | + '%' => '.' |
| 4750 | + ); |
| 4751 | + return str_replace( |
| 4752 | + array_keys( $replacearray ), |
| 4753 | + array_values( $replacearray ), |
| 4754 | + $sectionanchor ); |
4745 | 4755 | } |
4746 | 4756 | |
4747 | 4757 | /** |