r45341 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45340‎ | r45341 | r45342 >
Date:20:30, 2 January 2009
Author:simetrical
Status:reverted (Comments)
Tags:
Comment:
Use Sanitizer::escapeId() in another place

Reduce code duplication some more, and fix section redirect after edit
when $wgEnforceHtmlIds is off.
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -4684,21 +4684,11 @@
46854685 * "== Header ==".
46864686 */
46874687 public function guessSectionNameFromWikiText( $text ) {
 4688+ global $wgEnforceHtmlIds;
46884689 # Strip out wikitext links(they break the anchor)
46894690 $text = $this->stripSectionName( $text );
4690 - $headline = Sanitizer::decodeCharReferences( $text );
4691 - # strip out HTML
4692 - $headline = StringUtils::delimiterReplace( '<', '>', '', $headline );
4693 - $headline = trim( $headline );
4694 - $sectionanchor = '#' . urlencode( str_replace( ' ', '_', $headline ) );
4695 - $replacearray = array(
4696 - '%3A' => ':',
4697 - '%' => '.'
4698 - );
4699 - return str_replace(
4700 - array_keys( $replacearray ),
4701 - array_values( $replacearray ),
4702 - $sectionanchor );
 4691+ return '#' . Sanitizer::escapeId( $text,
 4692+ $wgEnforceHtmlIds ? array() : 'xml' );
47034693 }
47044694
47054695 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r45470Reverting r45341 " Use Sanitizer::escapeId() in another place Reduce code dup...brion00:00, 7 January 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   00:00, 7 January 2009

This produces non-matching stuff like "#_Rock_on_dudes_" for == ''Rock on'' dudes ==.

Reverted in r45470

Status & tagging log