Revert r68358. Causes bug 27474.
authorPlatonides <platonides@users.mediawiki.org>
Tue, 5 Apr 2011 22:38:37 +0000 (22:38 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Tue, 5 Apr 2011 22:38:37 +0000 (22:38 +0000)
Added parser test. Added another parser test for what it seems to try to account for
but that in fact doesn't change when trying to achieve, since ids don't seem to be
affected when flipping $wgHtml5 and $wgExperimentalHtmlIds (so r68358 seems useless).

includes/Title.php
tests/parser/parserTests.txt

index 7a1919e..08e3695 100644 (file)
@@ -2672,7 +2672,7 @@ class Title {
                }
                $fragment = strstr( $dbkey, '#' );
                if ( false !== $fragment ) {
-                       $this->setFragment( preg_replace( '/^#_*/', '#', $fragment ) );
+                       $this->setFragment( $fragment );
                        $dbkey = substr( $dbkey, 0, strlen( $dbkey ) - strlen( $fragment ) );
                        # remove whitespace again: prevents "Foo_bar_#"
                        # becoming "Foo_bar_"
@@ -4259,4 +4259,4 @@ class BadTitle extends Title {
        public function getPrefixedDBKey(){
                return '';
        }
-}
\ No newline at end of file
+}
index d7996f4..e6b7ea4 100644 (file)
@@ -8248,7 +8248,8 @@ title=[[Main Page]]
 !!input
 [[#section]]
 !! result
-<a href="#section">#section</a>
+<p><a href="#section">#section</a>
+</p>
 !! end
 
 !! test
@@ -8262,6 +8263,24 @@ title=[[Main Page]]
 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
 !! end
 
+!! test
+Anchor starting with underscore
+!!input
+[[#_ref|One]]
+!! result
+<p><a href="#_ref">One</a>
+</p>
+!! end
+
+!! test
+Id starting with underscore
+!!input
+<div id="_ref"></div>
+!! result
+<div id="_ref"></div>
+
+!! end
+
 !! test
 Space normalisation on autocomment (bug 22784)
 !! options