introducing new CoreParserFunction nse as an url-friendly equivalent to ns. bug 12920
authorTobias <churchofemacs@users.mediawiki.org>
Sun, 2 Aug 2009 18:16:56 +0000 (18:16 +0000)
committerTobias <churchofemacs@users.mediawiki.org>
Sun, 2 Aug 2009 18:16:56 +0000 (18:16 +0000)
RELEASE-NOTES
includes/parser/CoreParserFunctions.php
languages/messages/MessagesEn.php

index 3677fcf..a486ff4 100644 (file)
@@ -174,6 +174,8 @@ this. Was used when mwEmbed was going to be an extension.
 * (bug 20014) Added CSS class "mw-listgrouprights-right-name" is wrapped on the
   right name in Special:ListGroupRights
 * The description message in $wgExtensionCredits can be an array with parameters
+* (bug 12920) New CoreParserFunction {{nse:...}} as an url-friendly equivalent
+  to {{ns:...}}
 
 === Bug fixes in 1.16 ===
 
@@ -366,7 +368,6 @@ this. Was used when mwEmbed was going to be an extension.
 * (bug 17395) Remote file descriptions use user language ($wgLang), not wiki
   language ($wgContLang)
 
-
 == API changes in 1.16 ==
 
 * Added uiprop=changeablegroups to meta=userinfo
index 129fca1..d1fe95f 100644 (file)
@@ -16,6 +16,7 @@ class CoreParserFunctions {
 
                $parser->setFunctionHook( 'int',              array( __CLASS__, 'intFunction'      ), SFH_NO_HASH );
                $parser->setFunctionHook( 'ns',               array( __CLASS__, 'ns'               ), SFH_NO_HASH );
+               $parser->setFunctionHook( 'nse',              array( __CLASS__, 'nse'              ), SFH_NO_HASH );
                $parser->setFunctionHook( 'urlencode',        array( __CLASS__, 'urlencode'        ), SFH_NO_HASH );
                $parser->setFunctionHook( 'lcfirst',          array( __CLASS__, 'lcfirst'          ), SFH_NO_HASH );
                $parser->setFunctionHook( 'ucfirst',          array( __CLASS__, 'ucfirst'          ), SFH_NO_HASH );
@@ -118,6 +119,10 @@ class CoreParserFunctions {
                        return array( 'found' => false );
                }
        }
+       
+       static function nse( $parser, $part1 = '' ) {
+               return wfUrlencode( str_replace( ' ', '_', self::ns( $parser, $part1 ) ) );
+       }
 
        static function urlencode( $parser, $s = '' ) {
                return urlencode( $s );
index 4c92886..5b4f06f 100644 (file)
@@ -291,6 +291,7 @@ $magicWords = array(
        'int'                    => array( 0,    'INT:'                   ),
        'sitename'               => array( 1,    'SITENAME'               ),
        'ns'                     => array( 0,    'NS:'                    ),
+       'nse'                    => array( 0,    'NSE:'                   ),
        'localurl'               => array( 0,    'LOCALURL:'              ),
        'localurle'              => array( 0,    'LOCALURLE:'             ),
        'server'                 => array( 0,    'SERVER'                 ),