UNPKG

vue-files-preview-inno

Version:

A tool for previewing files such as doc, excel, pdf, image, markdown, txt, audio, and video and so on.

35 lines (34 loc) 1.11 kB
import { fromCodePoint as i, isValidEntityCode as f } from "../common/utils.mjs"; import { decodeHTML as p } from "../../../entities/lib/esm/decode.mjs"; const a = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i, u = /^&([a-z][a-z0-9]{1,31});/i; function m(c, r) { const t = c.pos, s = c.posMax; if (c.src.charCodeAt(t) !== 38 || t + 1 >= s) return !1; if (c.src.charCodeAt(t + 1) === 35) { const o = c.src.slice(t).match(a); if (o) { if (!r) { const e = o[1][0].toLowerCase() === "x" ? parseInt(o[1].slice(1), 16) : parseInt(o[1], 10), n = c.push("text_special", "", 0); n.content = f(e) ? i(e) : i(65533), n.markup = o[0], n.info = "entity"; } return c.pos += o[0].length, !0; } } else { const o = c.src.slice(t).match(u); if (o) { const e = p(o[0]); if (e !== o[0]) { if (!r) { const n = c.push("text_special", "", 0); n.content = e, n.markup = o[0], n.info = "entity"; } return c.pos += o[0].length, !0; } } } return !1; } export { m as default }; //# sourceMappingURL=entity.mjs.map