Subramanya Sastry has uploaded a new change for review.
https://gerrit.wikimedia.org/r/248943
Change subject: Revert "Categories in templates shouldn't force a line break
during html2wt"
......................................................................
Revert "Categories in templates shouldn't force a line break during html2wt"
This is actually more complicated than this
For now, reverting the "serialize link on own line" set of patches.
This reverts commit 458a11b755af4f47013b36efb8efaa0e0dcc0f64.
Change-Id: Ia21e1c979db2713b21e030b9c7572288747eba89
---
M lib/wts.TagHandlers.js
M tests/mocha/jsapi.js
M tests/parserTests.txt
3 files changed, 5 insertions(+), 29 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/43/248943/1
diff --git a/lib/wts.TagHandlers.js b/lib/wts.TagHandlers.js
index 2c1a605..0f42bd4 100644
--- a/lib/wts.TagHandlers.js
+++ b/lib/wts.TagHandlers.js
@@ -1171,9 +1171,7 @@
sepnls: {
before: function(node, otherNode) {
// sol-transparent link nodes are the only
thing on their line
- if (DU.isSolTransparentLink(node) &&
- !DU.isEncapsulationWrapper(node) &&
- !DU.isBody(otherNode)) {
+ if (DU.isSolTransparentLink(node) &&
!DU.isBody(otherNode)) {
return { min: 1 };
} else {
return {};
@@ -1181,9 +1179,7 @@
},
after: function(node, otherNode, state) {
// sol-transparent link nodes are the only
thing on their line
- if (DU.isSolTransparentLink(node) &&
- !DU.isEncapsulationWrapper(node) &&
- !DU.isBody(otherNode)) {
+ if (DU.isSolTransparentLink(node) &&
!DU.isBody(otherNode)) {
return { min: 1 };
} else {
return {};
diff --git a/tests/mocha/jsapi.js b/tests/mocha/jsapi.js
index c777365..8acad1b 100644
--- a/tests/mocha/jsapi.js
+++ b/tests/mocha/jsapi.js
@@ -87,7 +87,7 @@
template.name = 'bar-stub';
}
});
- String(pdoc).should.equal("{{cleanup|date = July 2012}}
'''Foo''' is a [[bar]]. {{bar-stub}}");
+ String(pdoc).should.equal("{{cleanup|date = July 2012}}
'''Foo''' is a [[bar]]. {{bar-stub}}\n");
});
});
});
@@ -105,7 +105,7 @@
template.add('test2',
Parsoid.PNodeList.fromHTML(pdoc, "I'm so <b>bold</b>!"));
}
});
- String(pdoc).should.equal("{{echo|{{cleanup|date = July
2012|test1 = <nowiki>{{foo}}</nowiki>&bar{{!}}bat<nowiki><p></nowiki>|test2 =
I'm so '''bold'''!}} '''Foo''' is a [[bar]].}} {{uncategorized}}");
+ String(pdoc).should.equal("{{echo|{{cleanup|date = July
2012|test1 = <nowiki>{{foo}}</nowiki>&bar{{!}}bat<nowiki><p></nowiki>|test2 =
I'm so '''bold'''!}} '''Foo''' is a [[bar]].}} {{uncategorized}}\n");
});
});
it('is safe to mutate template arguments', function() {
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 89386a1..15f1cd1 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -24932,7 +24932,7 @@
!! html/parsoid
<h2><span about="#mwt1" typeof="mw:Transclusion" data-parsoid="{}"
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo
[[Category:Foo]]"}},"i":0}}]}'>foo </span><link rel="mw:PageProp/Category"
href="./Category:Foo" about="#mwt1" data-parsoid="{}" /></h2>
!! wikitext
-== {{echo|foo [[Category:Foo]]}} ==
+== {{echo|foo [[Category:Foo]]}} ==
!! end
!! test
@@ -25680,26 +25680,6 @@
# --------------------------------------------
# Tests spec'ing wikitext serialization norms |
# --------------------------------------------
-
-!! test
-1. Categories should always be serialized on their own line
-!! options
-parsoid=html2wt
-!! html/parsoid
-foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
-!! wikitext
-foo
-[[Category:Foo]]
-bar
-!! end
-
-!! test
-2. Categories that are part of templates should not introduce a line break
-!! wikitext
-foo {{echo|<span>bar</span> [[Category:baz]]}} bar
-!! html/parsoid
-<p>foo <span about="#mwt1" typeof="mw:Transclusion"
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<span>bar</span>
[[Category:baz]]"}},"i":0}}]}'>bar</span><span about="#mwt1"> </span><link
rel="mw:PageProp/Category" href="./Category:Baz" about="#mwt1"
data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:baz"}}'/>
bar</p>
-!! end
!! test
Lists: Add space after bullets
--
To view, visit https://gerrit.wikimedia.org/r/248943
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia21e1c979db2713b21e030b9c7572288747eba89
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits