From 4312c2ad40ad08ce425b6f23acc617bf25757d16 Mon Sep 17 00:00:00 2001 From: Liangent Date: Thu, 23 Apr 2015 06:33:48 +0000 Subject: [PATCH] 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 --- includes/Sanitizer.php | 1 + tests/parser/parserTests.txt | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) 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 -- 2.20.1