jenkins-bot has submitted this change and it was merged.
Change subject: Handle stray closing pre tag in ParagraphWrapper.
......................................................................
Handle stray closing pre tag in ParagraphWrapper.
The source of /ko/오프라_윈프리 seems to have a stray </pre> tag that
ParagraphWrapper couldn't handle. It caused an unnecessary state
transition.
Adds a test for stray closing pre tags.
Change-Id: I1cc00e91ba826d0df0eafefd85cc931855e2b8a6
---
M js/lib/ext.core.ParagraphWrapper.js
M js/tests/parserTests.txt
2 files changed, 18 insertions(+), 3 deletions(-)
Approvals:
Subramanya Sastry: Looks good to me, approved
jenkins-bot: Verified
diff --git a/js/lib/ext.core.ParagraphWrapper.js
b/js/lib/ext.core.ParagraphWrapper.js
index ccad2c5..2bd9440 100644
--- a/js/lib/ext.core.ParagraphWrapper.js
+++ b/js/lib/ext.core.ParagraphWrapper.js
@@ -292,9 +292,11 @@
// No pre-tokens inside html-p-tags -- swallow it.
return {};
} else {
-
this.manager.addTransform(this.onNewLineOrEOF.bind(this),
- "ParagraphWrapper:onNewLine", this.newlineRank,
'newline');
- this.inPre = false;
+ if ( this.inPre ) {
+
this.manager.addTransform(this.onNewLineOrEOF.bind(this),
+ "ParagraphWrapper:onNewLine",
this.newlineRank, 'newline');
+ this.inPre = false;
+ }
this.currLine.hasBlockToken = true;
return { tokens: [token] };
}
diff --git a/js/tests/parserTests.txt b/js/tests/parserTests.txt
index bf26412..985fa88 100644
--- a/js/tests/parserTests.txt
+++ b/js/tests/parserTests.txt
@@ -17143,6 +17143,19 @@
</body>
!!end
+## Currently the p-wrapper is fragile in how adds / removes transformations.
+## Having nested or stray pre tags results in the attempt to add duplicates,
+## causing an assertion fail. This test tries to prevent that situation.
+!!test
+Ensure ParagraphWrapper can deal with stray closing pre tags
+!!options
+parsoid=wt2html
+!!input
+plain text</pre>
+!!result
+plain text
+!!end
+
# -----------------------------------------------------------------
# The following section of tests are primarily to spec requirements
# around serialization of new/edited content.
--
To view, visit https://gerrit.wikimedia.org/r/79088
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1cc00e91ba826d0df0eafefd85cc931855e2b8a6
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[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