jenkins-bot has submitted this change and it was merged.
Change subject: Bug 50713: Strip two trailing newlines that action=parse adds
......................................................................
Bug 50713: Strip two trailing newlines that action=parse adds
action=parse adds two trailing newlines to the HTML it emits. Those newlines
are not emitted by an extension tag. Strip those even if there is no paragraph
wrapping.
Change-Id: Iddb0e0e92a5410092b3f9a88680767d78c9c473e
---
M js/lib/mediawiki.ApiRequest.js
1 file changed, 6 insertions(+), 1 deletion(-)
Approvals:
Subramanya Sastry: Looks good to me, approved
jenkins-bot: Verified
diff --git a/js/lib/mediawiki.ApiRequest.js b/js/lib/mediawiki.ApiRequest.js
index 66060d6..9822cbb 100644
--- a/js/lib/mediawiki.ApiRequest.js
+++ b/js/lib/mediawiki.ApiRequest.js
@@ -482,7 +482,12 @@
var parsedHtml = '';
try {
// Strip paragraph wrapper from the html
- parsedHtml =
data.parse.text['*'].replace(/(^<p>)|(<\/p>\s*$)/g, '');
+ parsedHtml = data.parse.text['*'];
+ // Strip two trailing newlines that action=parse adds after any
+ // extension output
+ parsedHtml = parsedHtml.replace(/\n\n$/, '');
+ // Also strip a paragraph wrapper, if any
+ parsedHtml = parsedHtml.replace(/(^<p>)|(<\/p>$)/g, '');
this.env.tp( 'Expanded ', this.text, parsedHtml );
// Add the source to the cache
--
To view, visit https://gerrit.wikimedia.org/r/72558
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iddb0e0e92a5410092b3f9a88680767d78c9c473e
Gerrit-PatchSet: 1
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