T105242: U is for urlencode
authorArlo Breault <abreault@wikimedia.org>
Wed, 7 Jan 2015 20:03:02 +0000 (12:03 -0800)
committerArlo Breault <abreault@wikimedia.org>
Wed, 8 Jul 2015 22:28:21 +0000 (15:28 -0700)
 * Urlencode and extension tags don't play nice. The current behaviour
   is pretty broken. For example,

      {{urlencode:<pre id="one">two</pre>}}

   outputs

       <pre id="one">two</pre>

   which isn't exactly urlencoded.

 * Just drop the unexpanded content; anything more seems unsafe. There's
   precedent for this already in anchorencode.

 * Noticed in the infobox caption for enwiki/%22F%22_Is_for_Fugitive

Change-Id: I0ec5d2fdeb71f762036464f65029afd029e8b4a1

includes/parser/CoreParserFunctions.php
tests/parser/parserTests.txt

index cf8cd41..8a30ad1 100644 (file)
@@ -178,7 +178,9 @@ class CoreParserFunctions {
                        default:
                                $func = 'urlencode';
                }
-               return $parser->markerSkipCallback( $s, $func );
+               // See T105242, where the choice to kill markers and various
+               // other options were discussed.
+               return $func( $parser->killMarkers( $s ) );
        }
 
        public static function lcfirst( $parser, $s = '' ) {
index 1670fe4..c70f8b2 100644 (file)
@@ -19846,10 +19846,12 @@ Strip marker in urlencode
 {{urlencode:x<nowiki/>y}}
 {{urlencode:x<nowiki/>y|wiki}}
 {{urlencode:x<nowiki/>y|path}}
+{{urlencode:x<pre id="one">two</pre>y}}
 !! html
 <p>xy
 xy
 xy
+xy
 </p>
 !! end