From 0443dd4c5c4ef8e85d659fd39288c53e6d906bd7 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Sun, 7 Feb 2010 13:17:05 +0000 Subject: [PATCH] Fixes for r62077 {{pipetrick:}} -> {{#pipetrick:}} per IAlex clearer documentation per Siebrand parser test for new magic word. --- includes/parser/CoreParserFunctions.php | 9 ++++++--- maintenance/parserTests.txt | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index bca239f8d9..37e8060901 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -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) diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 9a3d98cefd..264e207c58 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -2021,6 +2021,21 @@ title=[[User:Ævar Arnfjörð Bjarmason]]

!! end +!! test +Magic Word: {{#PIPETRICK:}} +!! options +title=[[Some (page)]] +!! input +{{#pipetrick:Hello (one)}} +{{#pipetrick:World, hi|}} +{{#pipetrick:|Other}} +!! result +

Hello +World +Other (page) +

+!! end + !! test Magic Word: {{REVISIONID}} !! input -- 2.20.1