list( $tc, $nc ) = Linker::getPipeTrickCharacterClasses();
$rexps = array (
# try this first, to turn "[[A, B (C)|]]" into "A, B"
- "/^(:?$nc+:|[:#\/]|$tc+\\/|)($tc+?)( \\($tc+\\)| ($tc+))$/", # [[ns:page (context)|]]
- "/^(:?$nc+:|[:#\/]|$tc+\\/|)($tc+?)( \\($tc+\\)| ($tc+)|)((?:,|,) $tc+|)$/", # [[ns:page (context), context|]]
+ "/^(:?$nc+:|[:#\/]|$tc+[\\/#]|)($tc+?)( \\($tc+\\)| ($tc+))$/", # [[ns:page (context)|]]
+ "/^(:?$nc+:|[:#\/]|$tc+[\\/#]|)($tc+?)( \\($tc+\\)| ($tc+)|)((?:,|,) $tc+|)$/", # [[ns:page (context), context|]]
);
}
$text = urldecode( $link );
) );
# Links of the form [[|<blah>]] or [[<blah>|]] perform pipe tricks
- # Note this only allows the # in the one position it works.
+ # Note this only allows the # in the position it works.
global $wgLegalTitleChars;
- $pipeTrickRe = "/\[\[(?:(\\|)([$wgLegalTitleChars]+)|(#?[$wgLegalTitleChars]+)\\|)\]\]/";
+ $pipeTrickRe = "/\[\[(?:(\\|)([$wgLegalTitleChars]+)|([#$wgLegalTitleChars]+)\\|)\]\]/";
$text = preg_replace_callback( $pipeTrickRe, array( $this, 'pstPipeTrickCallback' ), $text );
# Trim trailing whitespace
[[../context/relative (extra)|relative]]
!! end
+!! test
+pre-save transform: context links ("pipe trick") to sections on other pages
+!! options
+pst
+!! input
+[[other#page|]]
+[[Help:Somewhere/completely (wierd)#section (two)|]]
+!! result
+[[other#page|page]]
+[[Help:Somewhere/completely (wierd)#section (two)|section]]
+!! end
+
!! test
pre-save transform: context links ("pipe trick") with full-width characters
!! options