Index: trunk/phase3/maintenance/parserTests.txt |
— | — | @@ -2022,21 +2022,41 @@ |
2023 | 2023 | !! end |
2024 | 2024 | |
2025 | 2025 | !! test |
2026 | | -Magic Word: {{#PIPETRICK:}} |
| 2026 | +Magic Word: {{PIPETRICK}} |
2027 | 2027 | !! options |
2028 | 2028 | title=[[Some (page)]] |
2029 | 2029 | !! input |
2030 | | -{{#pipetrick:Hello (one)}} |
2031 | | -{{#pipetrick:World, hi|}} |
2032 | | -{{#pipetrick:|Other}} |
| 2030 | +{{PIPETRICK}} |
| 2031 | +{{PIPETRICK:Hello (one)}} |
| 2032 | +{{PIPETRICK:World, hi|}} |
| 2033 | +{{PIPETRICK:|Other}} |
2033 | 2034 | !! result |
2034 | | -<p>Hello |
| 2035 | +<p>Some |
| 2036 | +Hello |
2035 | 2037 | World |
2036 | 2038 | Other (page) |
2037 | 2039 | </p> |
2038 | 2040 | !! end |
2039 | 2041 | |
2040 | 2042 | !! test |
| 2043 | +Magic Word: {{PIPETRICKE}} |
| 2044 | +!! options |
| 2045 | +title=[[Some other (page)]] |
| 2046 | +!! input |
| 2047 | +{{PIPETRICKE}} |
| 2048 | +{{PIPETRICKE:User:Ævar Arnfjörð Bjarmason}} |
| 2049 | +{{PIPETRICKE:#Something to do|}} |
| 2050 | +{{PIPETRICKE:|The?last}} |
| 2051 | +!! result |
| 2052 | +<p>Some_other |
| 2053 | +%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason |
| 2054 | +Something_to_do |
| 2055 | +The%3Flast_(page) |
| 2056 | +</p> |
| 2057 | +!! end |
| 2058 | + |
| 2059 | + |
| 2060 | +!! test |
2041 | 2061 | Magic Word: {{REVISIONID}} |
2042 | 2062 | !! input |
2043 | 2063 | {{REVISIONID}} |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -2493,6 +2493,14 @@ |
2494 | 2494 | $subjPage = $this->mTitle->getSubjectPage(); |
2495 | 2495 | $value = $subjPage->getPrefixedUrl(); |
2496 | 2496 | break; |
| 2497 | + case 'pipetrick': |
| 2498 | + $text = $this->mTitle->getText(); |
| 2499 | + $value = $this->getPipeTrickText( $text ); |
| 2500 | + break; |
| 2501 | + case 'pipetricke': |
| 2502 | + $text = $this->mTitle->getText(); |
| 2503 | + $value = wfUrlEncode( str_replace( ' ', '_', $this->getPipeTrickText( $text ) ) ); |
| 2504 | + break; |
2497 | 2505 | case 'revisionid': |
2498 | 2506 | // Let the edit saving system know we should parse the page |
2499 | 2507 | // *after* a revision ID has been assigned. |
Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -67,7 +67,8 @@ |
68 | 68 | $parser->setFunctionHook( 'talkpagenamee', array( __CLASS__, 'talkpagenamee' ), SFH_NO_HASH ); |
69 | 69 | $parser->setFunctionHook( 'subjectpagename', array( __CLASS__, 'subjectpagename' ), SFH_NO_HASH ); |
70 | 70 | $parser->setFunctionHook( 'subjectpagenamee', array( __CLASS__, 'subjectpagenamee' ), SFH_NO_HASH ); |
71 | | - $parser->setFunctionHook( 'pipetrick', array( __CLASS__, 'pipetrick' ) ); |
| 71 | + $parser->setFunctionHook( 'pipetrick', array( __CLASS__, 'pipetrick' ), SFH_NO_HASH ); |
| 72 | + $parser->setFunctionHook( 'pipetricke', array( __CLASS__, 'pipetricke' ), SFH_NO_HASH ); |
72 | 73 | $parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS ); |
73 | 74 | $parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) ); |
74 | 75 | |
— | — | @@ -455,6 +456,13 @@ |
456 | 457 | } |
457 | 458 | |
458 | 459 | /** |
| 460 | + * Performs the pipetrick and then url encodes the result |
| 461 | + */ |
| 462 | + static function pipetricke( $parser, $link = '', $text = '' ) { |
| 463 | + return wfUrlEncode( str_replace( ' ', '_', CoreParserFunctions::pipetrick( &$parser, $link, $text ) ) ); |
| 464 | + } |
| 465 | + |
| 466 | + /** |
459 | 467 | * Return the number of pages in the given category, or 0 if it's nonexis- |
460 | 468 | * tent. This is an expensive parser function and can't be called too many |
461 | 469 | * times per page. |
Index: trunk/phase3/includes/MagicWord.php |
— | — | @@ -84,6 +84,8 @@ |
85 | 85 | 'revisionuser', |
86 | 86 | 'subpagename', |
87 | 87 | 'subpagenamee', |
| 88 | + 'pipetrick', |
| 89 | + 'pipetricke', |
88 | 90 | 'talkspace', |
89 | 91 | 'talkspacee', |
90 | 92 | 'subjectspace', |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -263,6 +263,8 @@ |
264 | 264 | 'talkpagenamee' => array( 1, 'TALKPAGENAMEE' ), |
265 | 265 | 'subjectpagename' => array( 1, 'SUBJECTPAGENAME', 'ARTICLEPAGENAME' ), |
266 | 266 | 'subjectpagenamee' => array( 1, 'SUBJECTPAGENAMEE', 'ARTICLEPAGENAMEE' ), |
| 267 | + 'pipetrick' => array( 1, 'PIPETRICK' ), |
| 268 | + 'pipetricke' => array( 1, 'PIPETRICKE' ), |
267 | 269 | 'msg' => array( 0, 'MSG:' ), |
268 | 270 | 'subst' => array( 0, 'SUBST:' ), |
269 | 271 | 'safesubst' => array( 0, 'SAFESUBST:' ), |
— | — | @@ -317,7 +319,6 @@ |
318 | 320 | 'plural' => array( 0, 'PLURAL:' ), |
319 | 321 | 'fullurl' => array( 0, 'FULLURL:' ), |
320 | 322 | 'fullurle' => array( 0, 'FULLURLE:' ), |
321 | | - 'pipetrick' => array( 0, 'PIPETRICK:' ), |
322 | 323 | 'lcfirst' => array( 0, 'LCFIRST:' ), |
323 | 324 | 'ucfirst' => array( 0, 'UCFIRST:' ), |
324 | 325 | 'lc' => array( 0, 'LC:' ), |