r45267 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45266‎ | r45267 | r45268 >
Date:00:46, 1 January 2009
Author:brion
Status:ok
Tags:
Comment:
Partial revert of r45109, r45116 -- removing the forced 'x' prefix from IDs not beginning with letters.
Since we're probably going to change all our section fragments to something nicer in the next couple weeks, and nothing seems to actually explode based on what we're doing so far, I'd rather leave them be for now rather than break existing section links.
Modified paths:
  • /trunk/phase3/includes/Sanitizer.php (modified) (history)
  • /trunk/phase3/maintenance/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.txt
@@ -1454,7 +1454,7 @@
14551455 !! input
14561456 [[%23%3c]][[%23%3e]]
14571457 !! result
1458 -<p><a href="#x.3C" title="">#&lt;</a><a href="#x.3E" title="">#&gt;</a>
 1458+<p><a href="#.3C" title="">#&lt;</a><a href="#.3E" title="">#&gt;</a>
14591459 </p>
14601460 !! end
14611461
@@ -3607,10 +3607,10 @@
36083608 <li class="toclevel-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
36093609 <ul>
36103610 <li class="toclevel-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
3611 -<li class="toclevel-6"><a href="#x.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
3612 -<li class="toclevel-6"><a href="#x.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
3613 -<li class="toclevel-6"><a href="#x.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
3614 -<li class="toclevel-6"><a href="#x.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
 3611+<li class="toclevel-6"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
 3612+<li class="toclevel-6"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
 3613+<li class="toclevel-6"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
 3614+<li class="toclevel-6"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
36153615 </ul>
36163616 </li>
36173617 </ul>
@@ -3629,10 +3629,10 @@
36303630 <a name="Level_4_Heading" id="Level_4_Heading"></a><h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline"> Level 4 Heading</span></h4>
36313631 <a name="Level_5_Heading" id="Level_5_Heading"></a><h5><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline"> Level 5 Heading</span></h5>
36323632 <a name="Level_6_Heading" id="Level_6_Heading"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline"> Level 6 Heading</span></h6>
3633 -<a name="x.3D_Level_7_Heading.3D" id="x.3D_Level_7_Heading.3D"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline">= Level 7 Heading=</span></h6>
3634 -<a name="x.3D.3D_Level_8_Heading.3D.3D" id="x.3D.3D_Level_8_Heading.3D.3D"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline">== Level 8 Heading==</span></h6>
3635 -<a name="x.3D.3D.3D_Level_9_Heading.3D.3D.3D" id="x.3D.3D.3D_Level_9_Heading.3D.3D.3D"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline">=== Level 9 Heading===</span></h6>
3636 -<a name="x.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D" id="x.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline">==== Level 10 Heading====</span></h6>
 3633+<a name=".3D_Level_7_Heading.3D" id=".3D_Level_7_Heading.3D"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline">= Level 7 Heading=</span></h6>
 3634+<a name=".3D.3D_Level_8_Heading.3D.3D" id=".3D.3D_Level_8_Heading.3D.3D"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline">== Level 8 Heading==</span></h6>
 3635+<a name=".3D.3D.3D_Level_9_Heading.3D.3D.3D" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline">=== Level 9 Heading===</span></h6>
 3636+<a name=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline">==== Level 10 Heading====</span></h6>
36373637
36383638 !! end
36393639
@@ -4662,7 +4662,7 @@
46634663 !! input
46644664 <span id="æ: v">byte</span>[[#æ: v|backlink]]
46654665 !! result
4666 -<p><span id="x.C3.A6:_v">byte</span><a href="#x.C3.A6:_v" title="">backlink</a>
 4666+<p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
46674667 </p>
46684668 !! end
46694669
@@ -6578,26 +6578,26 @@
65796579 !! result
65806580 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
65816581 <ul>
6582 -<li class="toclevel-1"><a href="#x2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
 6582+<li class="toclevel-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
65836583 <ul>
6584 -<li class="toclevel-2"><a href="#x6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
6585 -<li class="toclevel-2"><a href="#x3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
 6584+<li class="toclevel-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
 6585+<li class="toclevel-2"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
65866586 </ul>
65876587 </li>
6588 -<li class="toclevel-1"><a href="#x1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
 6588+<li class="toclevel-1"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
65896589 <ul>
6590 -<li class="toclevel-2"><a href="#x5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
6591 -<li class="toclevel-2"><a href="#x2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
 6590+<li class="toclevel-2"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
 6591+<li class="toclevel-2"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
65926592 </ul>
65936593 </li>
65946594 </ul>
65956595 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
6596 -<a name="x2" id="x2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline">2</span></h2>
6597 -<a name="x6" id="x6"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline">6</span></h6>
6598 -<a name="x3" id="x3"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline">3</span></h3>
6599 -<a name="x1" id="x1"></a><h1><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline">1</span></h1>
6600 -<a name="x5" id="x5"></a><h5><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline">5</span></h5>
6601 -<a name="x2_2" id="x2_2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline">2</span></h2>
 6596+<a name="2" id="2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline">2</span></h2>
 6597+<a name="6" id="6"></a><h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline">6</span></h6>
 6598+<a name="3" id="3"></a><h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline">3</span></h3>
 6599+<a name="1" id="1"></a><h1><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline">1</span></h1>
 6600+<a name="5" id="5"></a><h5><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline">5</span></h5>
 6601+<a name="2_2" id="2_2"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline">2</span></h2>
66026602
66036603 !! end
66046604
@@ -6843,7 +6843,7 @@
68446844 !! input
68456845 == -{Naslov}- ==
68466846 !! result
6847 -<a name="x-.7BNaslov.7D-" id="x-.7BNaslov.7D-"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уреди део: Naslov">уреди</a>]</span> <span class="mw-headline"> Naslov </span></h2>
 6847+<a name="-.7BNaslov.7D-" id="-.7BNaslov.7D-"></a><h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уреди део: Naslov">уреди</a>]</span> <span class="mw-headline"> Naslov </span></h2>
68486848
68496849 !! end
68506850
Index: trunk/phase3/includes/Sanitizer.php
@@ -802,11 +802,18 @@
803803 $id = urlencode( Sanitizer::decodeCharReferences( strtr( $id, ' ', '_' ) ) );
804804 $id = str_replace( array_keys( $replace ), array_values( $replace ), $id );
805805
 806+ /*
 807+ // Let's not go changing our links just yet, since we plan to
 808+ // rip this out anyway and switch to the prettier Unicode-friendly
 809+ // links as XHTML and HTML 5 allow and browsers seem to think is
 810+ // just a-ok to do.
 811+ //
806812 if ( !preg_match( '/^[a-zA-Z]/', $id )
807813 && !in_array( 'noninitial', $options ) ) {
808814 // Initial character must be a letter!
809815 $id = "x$id";
810816 }
 817+ */
811818 return $id;
812819 }
813820

Follow-up revisions

RevisionCommit summaryAuthorDate
r45417Refactor somewhat so that escapeId() works right...simetrical15:59, 5 January 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r45109Prepend x to section ids not starting with [a-z]...simetrical00:05, 28 December 2008
r45116Polish up r45109 (changes to header id generation)...simetrical03:31, 28 December 2008

Status & tagging log