From 679e08e0da36f829ffd8ec60e9e3beecab4b5925 Mon Sep 17 00:00:00 2001 From: cel Date: Thu, 23 Aug 2018 12:39:53 -0700 Subject: Unescape HTML in image names for alt text --- lib/util.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/util.js') diff --git a/lib/util.js b/lib/util.js index 9f17966..58bb4b0 100644 --- a/lib/util.js +++ b/lib/util.js @@ -169,6 +169,15 @@ u.escapeHTML = function (html) { .replace(/>/g, '>') } +u.unescapeHTML = function (text) { + if (typeof text !== 'string') return text + return text.replace(/&/g, '&') + .replace(/"/g, '"') + .replace(/'/g, '\'') + .replace(/>/g, '>') + .replace(/</g, '<') +} + u.pullSlice = function (start, end) { if (end == null) end = Infinity var offset = 0 -- cgit v1.2.3