From: Liangent Date: Thu, 23 Apr 2015 06:33:48 +0000 (+0000) Subject: Prevent unexpected }- in converter output X-Git-Tag: 1.31.0-rc.0~4232 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=4312c2ad40ad08ce425b6f23acc617bf25757d16;p=lhc%2Fweb%2Fwiklou.git Prevent unexpected }- in converter output Previously for input -{X}-, the converter sees -{A}-, so A}- with this change. In further processing, the span tag may be parsed and have its title attrib converted. For cases where the content is not processed further (eg. "R" = raw flag), "-{X}-" is left as is in the attrib, which is not so ideal, but at least it's better than the original extra }- outside the whole tag. Change-Id: Idbaaf53f914f362e5b8cc9fad02a524f8d591bb7 --- diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 6779189486..42b166dadd 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -1119,6 +1119,7 @@ class Sanitizer { '>' => '>', // we've received invalid input '"' => '"', // which should have been escaped. '{' => '{', + '}' => '}', // prevent unpaired language conversion syntax '[' => '[', "''" => '''', 'ISBN' => 'ISBN', diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index ed09203434..aa792084aa 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -16083,7 +16083,7 @@ div with braces in attribute value !! wikitext
Foo
!! html/php -
Foo
+
Foo
!! html/parsoid
Foo
@@ -20625,6 +20625,28 @@ Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiw # Since Parsoid is starting to emit canonical wikitext for links, # [http://example.com http://example.com] will not RT back to that # form anymore. +!! test +HTML markups with conversion syntax in attribs, nested in other conversion blocks +!! options +language=zh variant=zh-cn +!! wikitext +-{zh;zh-hans;zh-hant|A}- +!! html +

A +

+!! end + +!! test +HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet) +!! options +language=zh variant=zh-cn disabled +!! wikitext +-{A}- +!! html +

A +

+!! end + !! test Proper conversion of text in external links !! options