Fixes for r62077
authorConrad Irwin <conrad@users.mediawiki.org>
Sun, 7 Feb 2010 13:17:05 +0000 (13:17 +0000)
committerConrad Irwin <conrad@users.mediawiki.org>
Sun, 7 Feb 2010 13:17:05 +0000 (13:17 +0000)
 {{pipetrick:}} -> {{#pipetrick:}} per IAlex
 clearer documentation per Siebrand
 parser test for new magic word.

includes/parser/CoreParserFunctions.php
maintenance/parserTests.txt

index bca239f..37e8060 100644 (file)
@@ -67,7 +67,7 @@ class CoreParserFunctions {
                $parser->setFunctionHook( 'talkpagenamee',    array( __CLASS__, 'talkpagenamee'    ), SFH_NO_HASH );
                $parser->setFunctionHook( 'subjectpagename',  array( __CLASS__, 'subjectpagename'  ), SFH_NO_HASH );
                $parser->setFunctionHook( 'subjectpagenamee', array( __CLASS__, 'subjectpagenamee' ), SFH_NO_HASH );
-               $parser->setFunctionHook( 'pipetrick',        array( __CLASS__, 'pipetrick'        ), SFH_NO_HASH );
+               $parser->setFunctionHook( 'pipetrick',        array( __CLASS__, 'pipetrick'        ) );
                $parser->setFunctionHook( 'tag',              array( __CLASS__, 'tagObj'           ), SFH_OBJECT_ARGS );
                $parser->setFunctionHook( 'formatdate',           array( __CLASS__, 'formatDate'           ) );
 
@@ -441,8 +441,11 @@ class CoreParserFunctions {
        }
 
        /**
-        * Performs the pipe trick. Can be used in three ways:
-        * {{pipetrick:title}} == {{pipetrick:title|}} != {{pipetrick:|title}}
+        * Performs the pipe trick in the same manner as [[title|]] or [[|title]].
+        * {{#pipetrick:title}} == {{#pipetrick:title|}} -> Parser::getPipeTrickText
+        * {{#pipetrick:|title}} -> Parser::getPipeTrickLink (rarer)
+        * See http://en.wikipedia.org/wiki/Help:Pipe_trick and the Parser documentation
+        * for more information.
         */
        static function pipetrick( $parser, $link = '', $text = '' ) {
                if ($link)
index 9a3d98c..264e207 100644 (file)
@@ -2021,6 +2021,21 @@ title=[[User:Ævar Arnfjörð Bjarmason]]
 </p>
 !! end
 
+!! test
+Magic Word: {{#PIPETRICK:}}
+!! options
+title=[[Some (page)]]
+!! input
+{{#pipetrick:Hello (one)}}
+{{#pipetrick:World, hi|}}
+{{#pipetrick:|Other}}
+!! result
+<p>Hello
+World
+Other (page)
+</p>
+!! end
+
 !! test
 Magic Word: {{REVISIONID}}
 !! input