Index: trunk/phase3/maintenance/parserTests.txt |
— | — | @@ -3052,6 +3052,18 @@ |
3053 | 3053 | !! end |
3054 | 3054 | |
3055 | 3055 | !! test |
| 3056 | +pre-save transform: context links ("pipe trick") to sections on other pages |
| 3057 | +!! options |
| 3058 | +pst |
| 3059 | +!! input |
| 3060 | +[[other#page|]] |
| 3061 | +[[Help:Somewhere/completely (wierd)#section (two)|]] |
| 3062 | +!! result |
| 3063 | +[[other#page|page]] |
| 3064 | +[[Help:Somewhere/completely (wierd)#section (two)|section]] |
| 3065 | +!! end |
| 3066 | + |
| 3067 | +!! test |
3056 | 3068 | pre-save transform: context links ("pipe trick") with full-width characters |
3057 | 3069 | !! options |
3058 | 3070 | pst |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -4033,9 +4033,9 @@ |
4034 | 4034 | ) ); |
4035 | 4035 | |
4036 | 4036 | # Links of the form [[|<blah>]] or [[<blah>|]] perform pipe tricks |
4037 | | - # Note this only allows the # in the one position it works. |
| 4037 | + # Note this only allows the # in the position it works. |
4038 | 4038 | global $wgLegalTitleChars; |
4039 | | - $pipeTrickRe = "/\[\[(?:(\\|)([$wgLegalTitleChars]+)|(#?[$wgLegalTitleChars]+)\\|)\]\]/"; |
| 4039 | + $pipeTrickRe = "/\[\[(?:(\\|)([$wgLegalTitleChars]+)|([#$wgLegalTitleChars]+)\\|)\]\]/"; |
4040 | 4040 | $text = preg_replace_callback( $pipeTrickRe, array( $this, 'pstPipeTrickCallback' ), $text ); |
4041 | 4041 | |
4042 | 4042 | # Trim trailing whitespace |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -1237,8 +1237,8 @@ |
1238 | 1238 | list( $tc, $nc ) = Linker::getPipeTrickCharacterClasses(); |
1239 | 1239 | $rexps = array ( |
1240 | 1240 | # try this first, to turn "[[A, B (C)|]]" into "A, B" |
1241 | | - "/^(:?$nc+:|[:#\/]|$tc+\\/|)($tc+?)( \\($tc+\\)| ($tc+))$/", # [[ns:page (context)|]] |
1242 | | - "/^(:?$nc+:|[:#\/]|$tc+\\/|)($tc+?)( \\($tc+\\)| ($tc+)|)((?:,|,) $tc+|)$/", # [[ns:page (context), context|]] |
| 1241 | + "/^(:?$nc+:|[:#\/]|$tc+[\\/#]|)($tc+?)( \\($tc+\\)| ($tc+))$/", # [[ns:page (context)|]] |
| 1242 | + "/^(:?$nc+:|[:#\/]|$tc+[\\/#]|)($tc+?)( \\($tc+\\)| ($tc+)|)((?:,|,) $tc+|)$/", # [[ns:page (context), context|]] |
1243 | 1243 | ); |
1244 | 1244 | } |
1245 | 1245 | $text = urldecode( $link ); |