Liangent has uploaded a new change for review.
https://gerrit.wikimedia.org/r/206079
Change subject: Prevent unexpected }- in converter output
......................................................................
Prevent unexpected }- in converter output
Previously for input -{<span title="-{X}-">X</span>}-, the converter
sees -{<span title="-{X}-">A</span>}-, so <span title="-{X
becomes the content in the first block, and a stray }- is left to output.
Now, the converter sees -{<span title="-{X}-">A</span>}- 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
---
M includes/Sanitizer.php
M tests/parser/parserTests.txt
2 files changed, 23 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/79/206079/1
diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php
index 96193a7..713cfd4 100644
--- a/includes/Sanitizer.php
+++ b/includes/Sanitizer.php
@@ -1051,6 +1051,7 @@
'>' => '>', // 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 e965352..43097e9 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -18305,6 +18305,28 @@
!! end
!! 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|<span title="-{X}-">A</span>}-
+!! html
+<p><span title="X">A</span>
+</p>
+!! 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
+-{<span title="-{X}-">A</span>}-
+!! html
+<p><span title="X">A</span>
+</p>
+!! end
+
+!! test
Proper conversion of text in external links
!! options
language=sr variant=sr-ec
--
To view, visit https://gerrit.wikimedia.org/r/206079
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idbaaf53f914f362e5b8cc9fad02a524f8d591bb7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Liangent <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits