jenkins-bot has submitted this change and it was merged.
Change subject: Bug 49428: Default to two preceding newlines for new headings
......................................................................
Bug 49428: Default to two preceding newlines for new headings
Also updated the parserTests.txt version and the blacklist.
Change-Id: Id8e5b87602e3ba0f0e1cf6b5c6e03f4949e7d053
---
M js/lib/mediawiki.WikitextSerializer.js
M js/tests/fetch-parserTests.txt.js
M js/tests/parserTests-blacklist.js
3 files changed, 28 insertions(+), 6 deletions(-)
Approvals:
Subramanya Sastry: Looks good to me, approved
jenkins-bot: Verified
diff --git a/js/lib/mediawiki.WikitextSerializer.js
b/js/lib/mediawiki.WikitextSerializer.js
index a076c5d..e63f1d9 100644
--- a/js/lib/mediawiki.WikitextSerializer.js
+++ b/js/lib/mediawiki.WikitextSerializer.js
@@ -1668,7 +1668,8 @@
handle: function(node, state, cb) {
cb(headingWT, node);
if (node.childNodes.length) {
- var headingHandler =
state.serializer.wteHandlers.headingHandler.bind(state.serializer.wteHandlers,
node);
+ var headingHandler = state.serializer
+
.wteHandlers.headingHandler.bind(state.serializer.wteHandlers, node);
state.serializeChildren(node, cb,
headingHandler);
} else {
// Deal with empty headings
@@ -1677,7 +1678,14 @@
cb(headingWT, node);
},
sepnls: {
- before: id({min:1, max:2}),
+ before: function (node, otherNode) {
+ if (DU.isNewElt(node) &&
DU.previousNonSepSibling(node)) {
+ // Default to two preceding newlines
for new content
+ return {min:2, max:2};
+ } else {
+ return {min:1, max:2};
+ }
+ },
after: id({min:1, max:2})
}
};
diff --git a/js/tests/fetch-parserTests.txt.js
b/js/tests/fetch-parserTests.txt.js
index 0e64eb3..33784d0 100755
--- a/js/tests/fetch-parserTests.txt.js
+++ b/js/tests/fetch-parserTests.txt.js
@@ -10,9 +10,9 @@
// and update these hashes automatically.
//
// You can use 'sha1sum -b tests/parser/parserTests.txt' to compute this value:
-var expectedSHA1 = "04b370af444eb10f13f7793d5b80c9188f80569c";
+var expectedSHA1 = "6dece70c05306b6b43cebba77ea3bd3d5d174686";
// git log --pretty=oneline -1 tests/parser/parserTests.txt
-var latestCommit = "7fadd2c9f3fb8914f5ac4aabddbb761d66427c64";
+var latestCommit = "11b306fe5fd7d9d75731d37d069612bb6a3d9968";
var fs = require('fs'),
path = require('path'),
diff --git a/js/tests/parserTests-blacklist.js
b/js/tests/parserTests-blacklist.js
index 6af4eef..0447c52 100644
--- a/js/tests/parserTests-blacklist.js
+++ b/js/tests/parserTests-blacklist.js
@@ -73,6 +73,7 @@
add("wt2html", "Unclosed formatting tags that straddle lists are closed and
reopened\n(Parsoid-only since php parser generates broken html -- relies on
Tidy to fix up)");
add("wt2html", "List interrupted by empty line or heading");
add("wt2html", "Single-comment whitespace lines dont break lists, but
multi-comment whitespace lines do");
+add("wt2html", "Test the li-hack\n(Cannot test this with PHP parser since it
relies on Tidy for the hack)");
add("wt2html", "Magic Word: {{FULLPAGENAMEE}}");
add("wt2html", "Magic Word: {{NAMESPACE}}");
add("wt2html", "Magic Word: {{NAMESPACEE}}");
@@ -461,6 +462,10 @@
add("wt2html", "1. SOL-sensitive wikitext tokens as template-args");
add("wt2html", "Ref: 9. unclosed comments should not leak out of ref-body");
add("wt2html", "Headings: 2. Outside heading nest on a single line
<h1>foo</h1>*bar");
+add("wt2html", "Headings: 6a. Heading chars in SOL context (with trailing
spaces)");
+add("wt2html", "Headings: 6b. Heading chars in SOL context (with trailing
newlines)");
+add("wt2html", "Headings: 6c. Heading chars in SOL context (leading newline
break)");
+add("wt2html", "Headings: 6d. Heading chars in SOL context (with interspersed
comments)");
add("wt2html", "Tables: 1b. No escaping needed");
add("wt2html", "Tables: 1c. No escaping needed");
add("wt2html", "Tables: 1d. No escaping needed");
@@ -469,7 +474,7 @@
add("wt2html", "Links 3. WikiLinks: No escapes needed");
add("wt2html", "Links 4. ExtLinks: Escapes needed");
add("wt2html", "Links 5. ExtLinks: No escapes needed");
-add("wt2html", "1. Leading space in SOL context should be escaped");
+add("wt2html", "1. Leading whitespace in SOL context should be escaped");
add("wt2html", "1. a tags");
add("wt2html", "Table with broken attribute value quoting on consecutive
lines");
add("wt2html", "Parsoid-only: Don't wrap broken template tags in <nowiki> on
wt2wt (Bug 42353)");
@@ -528,6 +533,7 @@
add("wt2wt", "Horizontal ruler (should it add that extra space?)");
add("wt2wt", "Nested lists 3 (first element empty)");
add("wt2wt", "Nested lists 6 (both elements empty)");
+add("wt2wt", "Test the li-hack\n(Cannot test this with PHP parser since it
relies on Tidy for the hack)");
add("wt2wt", "Magic Word: {{REVISIONID}}");
add("wt2wt", "Case-sensitive magic words, when cased differently, should just
be template transclusions");
add("wt2wt", "Nonexistent template");
@@ -658,6 +664,7 @@
add("html2html", "Plain link, capitalized");
add("html2html", "Plain link, uncapitalized");
add("html2html", "Piped link");
+add("html2html", "Piped link with comment in link text");
add("html2html", "Broken link");
add("html2html", "Broken link with fragment");
add("html2html", "Special page link with fragment");
@@ -1054,12 +1061,16 @@
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", "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)");
+add("html2html", "Headings: 6b. Heading chars in SOL context (with trailing
newlines)");
+add("html2html", "Headings: 6c. Heading chars in SOL context (leading newline
break)");
+add("html2html", "Headings: 6d. Heading chars in SOL context (with
interspersed comments)");
add("html2html", "Links 1. Quote marks in link text");
add("html2html", "Links 2. WikiLinks: Escapes needed");
add("html2html", "Links 3. WikiLinks: No escapes needed");
add("html2html", "Links 4. ExtLinks: Escapes needed");
add("html2html", "Links 5. ExtLinks: No escapes needed");
-add("html2html", "1. Leading space in SOL context should be escaped");
+add("html2html", "1. Leading whitespace in SOL context should be escaped");
add("html2html", "1. a tags");
add("html2html", "Parsoid-only: Don't wrap broken template tags in <nowiki> on
wt2wt (Bug 42353)");
add("html2html", "Parsoid-only: Don't wrap broken template tags in <nowiki> on
wt2wt (Bug 42353)");
@@ -1220,6 +1231,7 @@
add("html2wt", "Bug 4781, 5267: %28, %29 in bracketed URL");
add("html2wt", "External link containing double-single-quotes in text embedded
in italics (bug 4598 sanity check)");
add("html2wt", "External link containing double-single-quotes with no space
separating the url from text in italics");
+add("html2wt", "External link with comments in link text");
add("html2wt", "URL-encoding in URL functions (single parameter)");
add("html2wt", "URL-encoding in URL functions (multiple parameters)");
add("html2wt", "Brackets in urls");
@@ -1253,6 +1265,7 @@
add("html2wt", "Plain link, capitalized");
add("html2wt", "Plain link, uncapitalized");
add("html2wt", "Piped link");
+add("html2wt", "Piped link with comment in link text");
add("html2wt", "Broken link");
add("html2wt", "Broken link with fragment");
add("html2wt", "Special page link with fragment");
@@ -1948,6 +1961,7 @@
add("html2wt", "References: 2. references tag with group only outputs
references from that group");
add("html2wt", "References: 4. only referenced group should be cleared after
processing references");
add("html2wt", "References: 5. ref tags in references should be processed
while ignoring all other content");
+add("html2wt", "Headings: 6a. Heading chars in SOL context (with trailing
spaces)");
add("html2wt", "Tables: 1b. No escaping needed");
add("html2wt", "Tables: 1c. No escaping needed");
add("html2wt", "Tables: 1d. No escaping needed");
--
To view, visit https://gerrit.wikimedia.org/r/70214
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id8e5b87602e3ba0f0e1cf6b5c6e03f4949e7d053
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <[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