Arlolra has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/382185 )
Change subject: Revert some of a563cd6f
......................................................................
Revert some of a563cd6f
* Previously, trailing separators in text nodes were stripped
unconditionally, but that change made it only if !inIndentPre.
* Fixes the regression on hiwiki/अल्ताफ राजा
Change-Id: I77e33add4c55c0f31a292f46c0eacc2fc8460623
---
M lib/html2wt/WikitextSerializer.js
1 file changed, 8 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/85/382185/1
diff --git a/lib/html2wt/WikitextSerializer.js
b/lib/html2wt/WikitextSerializer.js
index 72414f2..4c4d9f9 100644
--- a/lib/html2wt/WikitextSerializer.js
+++ b/lib/html2wt/WikitextSerializer.js
@@ -804,7 +804,10 @@
WSP._serializeTextNode = Promise.method(function(node) {
var res = node.nodeValue;
var state = this.state;
- var newSepMatch;
+
+ // Deal with trailing separator-like text (at least 1 newline and other
whitespace)
+ var newSepMatch = res.match(this.separatorREs.sepSuffixWithNlsRE);
+ res = res.replace(this.separatorREs.sepSuffixWithNlsRE, '');
if (!state.inIndentPre) {
// Strip leading newlines and other whitespace
@@ -813,10 +816,6 @@
state.setSep((state.sep.src || '') + match[0]);
res = res.substring(match[0].length);
}
-
- // Deal with trailing separator-like text (at least 1 newline
and other whitespace)
- newSepMatch = res.match(this.separatorREs.sepSuffixWithNlsRE);
- res = res.replace(this.separatorREs.sepSuffixWithNlsRE, '');
var doubleNewlineMatch =
res.match(this.separatorREs.doubleNewlineRE_G);
var doubleNewlineCount = doubleNewlineMatch &&
doubleNewlineMatch.length || 0;
@@ -861,6 +860,10 @@
WSP.emitWikitext = function(res, node) {
var state = this.state;
+ // Deal with trailing separator-like text (at least 1 newline and other
whitespace)
+ var newSepMatch = res.match(this.separatorREs.sepSuffixWithNlsRE);
+ res = res.replace(this.separatorREs.sepSuffixWithNlsRE, '');
+
if (!state.inIndentPre) {
// Strip leading newlines and other whitespace
var match = res.match(this.separatorREs.sepPrefixWithNlsRE);
@@ -869,10 +872,6 @@
res = res.substring(match[0].length);
}
}
-
- // Deal with trailing newlines
- var newSepMatch = res.match(this.separatorREs.sepSuffixWithNlsRE);
- res = res.replace(this.separatorREs.sepSuffixWithNlsRE, '');
state.emitChunk(res, node);
--
To view, visit https://gerrit.wikimedia.org/r/382185
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I77e33add4c55c0f31a292f46c0eacc2fc8460623
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits