diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-08-23 12:39:53 -0700 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-08-23 12:39:53 -0700 |
commit | 679e08e0da36f829ffd8ec60e9e3beecab4b5925 (patch) | |
tree | 9c3c04293ad16d65df65beb7aae27cbe77dfc1e7 /lib/util.js | |
parent | 369f72529e83414099bdf037c3015cc9f61a038d (diff) | |
download | patchfoo-679e08e0da36f829ffd8ec60e9e3beecab4b5925.tar.gz patchfoo-679e08e0da36f829ffd8ec60e9e3beecab4b5925.zip |
Unescape HTML in image names for alt text
Diffstat (limited to 'lib/util.js')
-rw-r--r-- | lib/util.js | 9 |
1 files changed, 9 insertions, 0 deletions
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 |