jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/405350 )
Change subject: Use underscore's implementation of escape ...................................................................... Use underscore's implementation of escape The underscore implementation handles a few more characters than ours did. Change-Id: Ic029bae9f8f9ad10b35bdbc41fb8a2346b0d6bf8 --- M lib/transformations/extractLeadIntroduction.js 1 file changed, 2 insertions(+), 19 deletions(-) Approvals: jenkins-bot: Verified Mholloway: Looks good to me, approved diff --git a/lib/transformations/extractLeadIntroduction.js b/lib/transformations/extractLeadIntroduction.js index f586951..7661b2c 100644 --- a/lib/transformations/extractLeadIntroduction.js +++ b/lib/transformations/extractLeadIntroduction.js @@ -1,6 +1,7 @@ 'use strict'; const NodeType = require('../nodeType'); +const _ = require('underscore'); /* * Check whether a node has any content. @@ -10,24 +11,6 @@ function isEmpty(node) { return node.textContent.trim().length === 0; } - -/* - * HTML escape a string. - * @param {!String} s - * @return {!String} - */ -function escape(s) { - return s.replace(/[&<>"']/g, (c) => { - switch (c) { - case '&': return '&'; - case '<': return '<'; - case '>': return '>'; - case '"': return '"'; - default: return; - } - }); -} - /* * Extracts the first non-empty paragraph from an article and any @@ -56,7 +39,7 @@ // Deal with text nodes if (nextSibling.nodeType === NodeType.TEXT_NODE) { if (!isEmpty(nextSibling)) { - p += escape(nextSibling.textContent); + p += _.escape(nextSibling.textContent); } } else { p += nextSibling.outerHTML; -- To view, visit https://gerrit.wikimedia.org/r/405350 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic029bae9f8f9ad10b35bdbc41fb8a2346b0d6bf8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/mobileapps Gerrit-Branch: master Gerrit-Owner: BearND <bsitzm...@wikimedia.org> Gerrit-Reviewer: Fjalapeno <cfl...@wikimedia.org> Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org> Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org> Gerrit-Reviewer: Mhurd <mh...@wikimedia.org> Gerrit-Reviewer: Ppchelko <ppche...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits