r24046 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24045‎ | r24046 | r24047 >
Date:21:02, 12 July 2007
Author:brion
Status:old
Tags:
Comment:
* (bug 9151) Fix relative subpage links with section fragments
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -1927,12 +1927,18 @@
19281928 wfProfileIn( $fname );
19291929 $ret = $target; # default return value is no change
19301930
1931 - # bug 7425
1932 - $target = trim( $target );
1933 -
19341931 # Some namespaces don't allow subpages,
19351932 # so only perform processing if subpages are allowed
19361933 if( $this->areSubpagesAllowed() ) {
 1934+ $hash = strpos( $target, '#' );
 1935+ if( $hash !== false ) {
 1936+ $suffix = substr( $target, $hash );
 1937+ $target = substr( $target, 0, $hash );
 1938+ } else {
 1939+ $suffix = '';
 1940+ }
 1941+ # bug 7425
 1942+ $target = trim( $target );
19371943 # Look at the first character
19381944 if( $target != '' && $target{0} == '/' ) {
19391945 # / at end means we don't want the slash to be shown
@@ -1944,9 +1950,9 @@
19451951 $noslash = substr( $target, 1 );
19461952 }
19471953
1948 - $ret = $this->mTitle->getPrefixedText(). '/' . trim($noslash);
 1954+ $ret = $this->mTitle->getPrefixedText(). '/' . trim($noslash) . $suffix;
19491955 if( '' === $text ) {
1950 - $text = $target;
 1956+ $text = $target . $suffix;
19511957 } # this might be changed for ugliness reasons
19521958 } else {
19531959 # check for .. subpage backlinks
@@ -1964,13 +1970,14 @@
19651971 if( substr( $nodotdot, -1, 1 ) == '/' ) {
19661972 $nodotdot = substr( $nodotdot, 0, -1 );
19671973 if( '' === $text ) {
1968 - $text = $nodotdot;
 1974+ $text = $nodotdot . $suffix;
19691975 }
19701976 }
19711977 $nodotdot = trim( $nodotdot );
19721978 if( $nodotdot != '' ) {
19731979 $ret .= '/' . $nodotdot;
19741980 }
 1981+ $ret .= $suffix;
19751982 }
19761983 }
19771984 }
Index: trunk/phase3/RELEASE-NOTES
@@ -285,7 +285,9 @@
286286 Now matches the selection behavior on Mozilla / Safari.
287287 Patch by Alex Smotrov.
288288 * Don't show non-functional toolbar buttons on Opera 7 anymore
 289+* (bug 9151) Fix relative subpage links with section fragments
289290
 291+
290292 == API changes since 1.10 ==
291293
292294 Full API documentation is available at http://www.mediawiki.org/wiki/API

Follow-up revisions

RevisionCommit summaryAuthorDate
r24096Merged revisions 23910-24094 via svnmerge from...david22:38, 14 July 2007

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r23979(bug 9151) Remove timed redirects on "Return to X" pages for accessibility.simetrical21:47, 10 July 2007

Status & tagging log