Improve wfEscapeWikiText, part 2
authorBrad Jorsch <bjorsch@wikimedia.org>
Fri, 20 Sep 2013 16:40:17 +0000 (12:40 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Fri, 20 Sep 2013 16:51:02 +0000 (12:51 -0400)
The following are now correctly escaped:
* Blank lines (including those with only tabs)
* ---- at the start of a line

Bug: 53658
Change-Id: I300e15a22c93ca542913135c9c83913c18c99faf

includes/GlobalFunctions.php

index 0c92ab6..414c822 100644 (file)
@@ -2032,6 +2032,10 @@ function wfEscapeWikiText( $text ) {
                        "\n*" => "\n&#42;", "\r*" => "\r&#42;",
                        "\n:" => "\n&#58;", "\r:" => "\r&#58;",
                        "\n " => "\n&#32;", "\r " => "\r&#32;",
+                       "\n\n" => "\n&#10;", "\r\n" => "&#13;\n",
+                       "\n\r" => "\n&#13;", "\r\r" => "\r&#13;",
+                       "\n\t" => "\n&#9;", "\r\t" => "\r&#9;", // "\n\t\n" is treated like "\n\n"
+                       "\n----" => "\n&#45;---", "\r----" => "\r&#45;---",
                        '__' => '_&#95;', '://' => '&#58;//',
                );