Subramanya Sastry has uploaded a new change for review.
https://gerrit.wikimedia.org/r/75129
Change subject: (Bug 51721) Suppress indent-pre nowikis in ref content
......................................................................
(Bug 51721) Suppress indent-pre nowikis in ref content
* Indent-pres are suppressed in ref-content. So, no reason to
add nowikis around leading whitespaces when serializing ref
tags either.
* One more html2html test now green.
Change-Id: I12d88c7cc59b95c0be884dd8fa3aa390aed122e8
---
M js/lib/mediawiki.WikitextSerializer.js
M js/tests/parserTests-blacklist.js
M js/tests/parserTests.txt
3 files changed, 8 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid
refs/changes/29/75129/1
diff --git a/js/lib/mediawiki.WikitextSerializer.js
b/js/lib/mediawiki.WikitextSerializer.js
index d8a669b..f78e751 100644
--- a/js/lib/mediawiki.WikitextSerializer.js
+++ b/js/lib/mediawiki.WikitextSerializer.js
@@ -766,7 +766,7 @@
// SSS FIXME: pre-escaping is currently broken since the front-end
parser
// eliminated pre-tokens in the tokenizer and moved to a stream handler.
// So, we always conservatively escape text with ' ' in sol posn.
- if (sol && text.match(/(^|\n)[ \t]+[^\s]+/)) {
+ if (sol && !this.options.noPreNowikis && text.match(/(^|\n)[
\t]+[^\s]+/)) {
// console.warn("---EWT:F6---");
return this.escapedText(state, sol, text, fullCheckNeeded);
}
@@ -3066,7 +3066,12 @@
} else {
srcParts.push(">");
if (typeof dataMW.body.html === 'string') {
- var wts = new WikitextSerializer({env: state.env});
+ var wts = new WikitextSerializer({
+ env: state.env,
+ // indent-pres are disabled in ref-bodies
+ // See ext.core.PreHandler.js
+ noPreNowikis: extName === 'ref'
+ });
srcParts.push(wts.serializeDOM(Util.parseHTML(dataMW.body.html).body));
} else if (dataMW.body.extsrc) {
srcParts.push(dataMW.body.extsrc);
diff --git a/js/tests/parserTests-blacklist.js
b/js/tests/parserTests-blacklist.js
index c518af8..735269d 100644
--- a/js/tests/parserTests-blacklist.js
+++ b/js/tests/parserTests-blacklist.js
@@ -1183,7 +1183,6 @@
add("html2html", "Gallery override link with absolute external link (bug
34852)");
add("html2html", "Gallery override link with malicious javascript (bug
34852)");
add("html2html", "Gallery with invalid title as link (bug 43964)");
-add("html2html", "Ref: 6. indent-pres should not be output in ref-body");
add("html2html", "Ref: 14. A nested ref-tag should be emitted as plain text");
add("html2html", "Headings: 2. Outside heading nest on a single line
<h1>foo</h1>*bar");
add("html2html", "Headings: 6a. Heading chars in SOL context (with trailing
spaces)");
diff --git a/js/tests/parserTests.txt b/js/tests/parserTests.txt
index 3084e95..abdd5c1 100644
--- a/js/tests/parserTests.txt
+++ b/js/tests/parserTests.txt
@@ -15939,6 +15939,7 @@
</p>
!! end
+
#### --------------- Others ---------------
!! test
Escaping nowikis
--
To view, visit https://gerrit.wikimedia.org/r/75129
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I12d88c7cc59b95c0be884dd8fa3aa390aed122e8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits