jenkins-bot has submitted this change and it was merged.

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
2 files changed, 7 insertions(+), 3 deletions(-)

Approvals:
  Cscott: Looks good to me, approved
  jenkins-bot: Verified



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)");

-- 
To view, visit https://gerrit.wikimedia.org/r/75129
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I12d88c7cc59b95c0be884dd8fa3aa390aed122e8
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to