Support {{!}} as a magic word
authorJackmcbarn <jackmcbarn@gmail.com>
Thu, 29 May 2014 21:08:13 +0000 (17:08 -0400)
committerJames D. Forrester <jforrester@wikimedia.org>
Thu, 26 Jun 2014 21:56:04 +0000 (14:56 -0700)
Add {{!}} as a magic word that expands to a pipe. Parsoid already does
this, so we know it isn't going to cause major breakage.

Change-Id: I1f857417d224d6443504074a5add852df3975b89

RELEASE-NOTES-1.24
includes/MagicWord.php
includes/parser/Parser.php
languages/messages/MessagesEn.php
tests/parser/parserTests.txt

index d8543b7..c43e730 100644 (file)
@@ -92,6 +92,8 @@ production.
 * Browser tests are now included to verify basic wiki functionality in developer
   environments. For details on running tests, see tests/browser/README.mediawiki.
 * Upgrade jStorage to v0.4.10.
+* {{!}} is now a magic word that produces the | character. This removes the need
+  for Template:! for purposes such as passing pipes inside of parameters.
 
 === Bug fixes in 1.24 ===
 * (bug 49116) Footer copyright notice is now always displayed in user language
index 3e327c3..7decbee 100644 (file)
@@ -96,6 +96,7 @@ class MagicWord {
 
        static public $mVariableIDsInitialised = false;
        static public $mVariableIDs = array(
+               '!',
                'currentmonth',
                'currentmonth1',
                'currentmonthname',
index fa5d678..eb7bd1b 100644 (file)
@@ -2820,6 +2820,9 @@ class Parser {
                $pageLang = $this->getFunctionLang();
 
                switch ( $index ) {
+                       case '!':
+                               $value = '|';
+                               break;
                        case 'currentmonth':
                                $value = $pageLang->formatNum( MWTimestamp::getInstance( $ts )->format( 'm' ) );
                                break;
index 07a0467..cabc89c 100644 (file)
@@ -209,6 +209,7 @@ $magicWords = array(
        'forcetoc'                => array( 0,    '__FORCETOC__' ),
        'toc'                     => array( 0,    '__TOC__' ),
        'noeditsection'           => array( 0,    '__NOEDITSECTION__' ),
+       '!'                       => array( 1,    '!' ),
        'currentmonth'            => array( 1,    'CURRENTMONTH', 'CURRENTMONTH2' ),
        'currentmonth1'           => array( 1,    'CURRENTMONTH1' ),
        'currentmonthname'        => array( 1,    'CURRENTMONTHNAME' ),
index 03e4959..f6238bb 100644 (file)
@@ -87,12 +87,6 @@ Template:tbl-end
 |}
 !! endarticle
 
-!! article
-Template:!
-!! text
-|
-!! endarticle
-
 !! article
 Template:echo
 !! text