Index: trunk/phase3/includes/Parser.php |
— | — | @@ -1927,12 +1927,18 @@ |
1928 | 1928 | wfProfileIn( $fname ); |
1929 | 1929 | $ret = $target; # default return value is no change |
1930 | 1930 | |
1931 | | - # bug 7425 |
1932 | | - $target = trim( $target ); |
1933 | | - |
1934 | 1931 | # Some namespaces don't allow subpages, |
1935 | 1932 | # so only perform processing if subpages are allowed |
1936 | 1933 | 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 ); |
1937 | 1943 | # Look at the first character |
1938 | 1944 | if( $target != '' && $target{0} == '/' ) { |
1939 | 1945 | # / at end means we don't want the slash to be shown |
— | — | @@ -1944,9 +1950,9 @@ |
1945 | 1951 | $noslash = substr( $target, 1 ); |
1946 | 1952 | } |
1947 | 1953 | |
1948 | | - $ret = $this->mTitle->getPrefixedText(). '/' . trim($noslash); |
| 1954 | + $ret = $this->mTitle->getPrefixedText(). '/' . trim($noslash) . $suffix; |
1949 | 1955 | if( '' === $text ) { |
1950 | | - $text = $target; |
| 1956 | + $text = $target . $suffix; |
1951 | 1957 | } # this might be changed for ugliness reasons |
1952 | 1958 | } else { |
1953 | 1959 | # check for .. subpage backlinks |
— | — | @@ -1964,13 +1970,14 @@ |
1965 | 1971 | if( substr( $nodotdot, -1, 1 ) == '/' ) { |
1966 | 1972 | $nodotdot = substr( $nodotdot, 0, -1 ); |
1967 | 1973 | if( '' === $text ) { |
1968 | | - $text = $nodotdot; |
| 1974 | + $text = $nodotdot . $suffix; |
1969 | 1975 | } |
1970 | 1976 | } |
1971 | 1977 | $nodotdot = trim( $nodotdot ); |
1972 | 1978 | if( $nodotdot != '' ) { |
1973 | 1979 | $ret .= '/' . $nodotdot; |
1974 | 1980 | } |
| 1981 | + $ret .= $suffix; |
1975 | 1982 | } |
1976 | 1983 | } |
1977 | 1984 | } |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -285,7 +285,9 @@ |
286 | 286 | Now matches the selection behavior on Mozilla / Safari. |
287 | 287 | Patch by Alex Smotrov. |
288 | 288 | * Don't show non-functional toolbar buttons on Opera 7 anymore |
| 289 | +* (bug 9151) Fix relative subpage links with section fragments |
289 | 290 | |
| 291 | + |
290 | 292 | == API changes since 1.10 == |
291 | 293 | |
292 | 294 | Full API documentation is available at http://www.mediawiki.org/wiki/API |