partial revert for r62081. Make {{PIPETRICK}} like {{PAGENAME}}, add {{PIPETRICKE}}. fix r62077 better.
This commit is contained in:
parent
7c5cf51e44
commit
7a1fc37382
5 changed files with 46 additions and 7 deletions
|
|
@ -84,6 +84,8 @@ class MagicWord {
|
|||
'revisionuser',
|
||||
'subpagename',
|
||||
'subpagenamee',
|
||||
'pipetrick',
|
||||
'pipetricke',
|
||||
'talkspace',
|
||||
'talkspacee',
|
||||
'subjectspace',
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ 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' ) );
|
||||
$parser->setFunctionHook( 'pipetrick', array( __CLASS__, 'pipetrick' ), SFH_NO_HASH );
|
||||
$parser->setFunctionHook( 'pipetricke', array( __CLASS__, 'pipetricke' ), SFH_NO_HASH );
|
||||
$parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS );
|
||||
$parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) );
|
||||
|
||||
|
|
@ -454,6 +455,13 @@ class CoreParserFunctions {
|
|||
return $parser->getPipeTrickLink( $text );
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the pipetrick and then url encodes the result
|
||||
*/
|
||||
static function pipetricke( $parser, $link = '', $text = '' ) {
|
||||
return wfUrlEncode( str_replace( ' ', '_', CoreParserFunctions::pipetrick( &$parser, $link, $text ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of pages in the given category, or 0 if it's nonexis-
|
||||
* tent. This is an expensive parser function and can't be called too many
|
||||
|
|
|
|||
|
|
@ -2493,6 +2493,14 @@ class Parser
|
|||
$subjPage = $this->mTitle->getSubjectPage();
|
||||
$value = $subjPage->getPrefixedUrl();
|
||||
break;
|
||||
case 'pipetrick':
|
||||
$text = $this->mTitle->getText();
|
||||
$value = $this->getPipeTrickText( $text );
|
||||
break;
|
||||
case 'pipetricke':
|
||||
$text = $this->mTitle->getText();
|
||||
$value = wfUrlEncode( str_replace( ' ', '_', $this->getPipeTrickText( $text ) ) );
|
||||
break;
|
||||
case 'revisionid':
|
||||
// Let the edit saving system know we should parse the page
|
||||
// *after* a revision ID has been assigned.
|
||||
|
|
|
|||
|
|
@ -263,6 +263,8 @@ $magicWords = array(
|
|||
'talkpagenamee' => array( 1, 'TALKPAGENAMEE' ),
|
||||
'subjectpagename' => array( 1, 'SUBJECTPAGENAME', 'ARTICLEPAGENAME' ),
|
||||
'subjectpagenamee' => array( 1, 'SUBJECTPAGENAMEE', 'ARTICLEPAGENAMEE' ),
|
||||
'pipetrick' => array( 1, 'PIPETRICK' ),
|
||||
'pipetricke' => array( 1, 'PIPETRICKE' ),
|
||||
'msg' => array( 0, 'MSG:' ),
|
||||
'subst' => array( 0, 'SUBST:' ),
|
||||
'safesubst' => array( 0, 'SAFESUBST:' ),
|
||||
|
|
@ -317,7 +319,6 @@ $magicWords = array(
|
|||
'plural' => array( 0, 'PLURAL:' ),
|
||||
'fullurl' => array( 0, 'FULLURL:' ),
|
||||
'fullurle' => array( 0, 'FULLURLE:' ),
|
||||
'pipetrick' => array( 0, 'PIPETRICK:' ),
|
||||
'lcfirst' => array( 0, 'LCFIRST:' ),
|
||||
'ucfirst' => array( 0, 'UCFIRST:' ),
|
||||
'lc' => array( 0, 'LC:' ),
|
||||
|
|
|
|||
|
|
@ -2022,20 +2022,40 @@ title=[[User:Ævar Arnfjörð Bjarmason]]
|
|||
!! end
|
||||
|
||||
!! test
|
||||
Magic Word: {{#PIPETRICK:}}
|
||||
Magic Word: {{PIPETRICK}}
|
||||
!! options
|
||||
title=[[Some (page)]]
|
||||
!! input
|
||||
{{#pipetrick:Hello (one)}}
|
||||
{{#pipetrick:World, hi|}}
|
||||
{{#pipetrick:|Other}}
|
||||
{{PIPETRICK}}
|
||||
{{PIPETRICK:Hello (one)}}
|
||||
{{PIPETRICK:World, hi|}}
|
||||
{{PIPETRICK:|Other}}
|
||||
!! result
|
||||
<p>Hello
|
||||
<p>Some
|
||||
Hello
|
||||
World
|
||||
Other (page)
|
||||
</p>
|
||||
!! end
|
||||
|
||||
!! test
|
||||
Magic Word: {{PIPETRICKE}}
|
||||
!! options
|
||||
title=[[Some other (page)]]
|
||||
!! input
|
||||
{{PIPETRICKE}}
|
||||
{{PIPETRICKE:User:Ævar Arnfjörð Bjarmason}}
|
||||
{{PIPETRICKE:#Something to do|}}
|
||||
{{PIPETRICKE:|The?last}}
|
||||
!! result
|
||||
<p>Some_other
|
||||
%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
|
||||
Something_to_do
|
||||
The%3Flast_(page)
|
||||
</p>
|
||||
!! end
|
||||
|
||||
|
||||
!! test
|
||||
Magic Word: {{REVISIONID}}
|
||||
!! input
|
||||
|
|
|
|||
Loading…
Reference in a new issue