working
This commit is contained in:
1 parent
f29df2b033
commit
a1976dfa65
1007 files changed
+101609
No files matched your search
+15
@@ -0,0 +1,15 @@
|
||||
import htmlDecodeTree from "./generated/decode-data-html";
|
||||
import xmlDecodeTree from "./generated/decode-data-xml";
|
||||
export { htmlDecodeTree, xmlDecodeTree };
|
||||
export declare enum BinTrieFlags {
|
||||
HAS_VALUE = 32768,
|
||||
BRANCH_LENGTH = 32512,
|
||||
MULTI_BYTE = 128,
|
||||
JUMP_TABLE = 127
|
||||
}
|
||||
export declare const JUMP_OFFSET_BASE: number;
|
||||
export declare function determineBranch(decodeTree: Uint16Array, current: number, nodeIdx: number, char: number): number;
|
||||
export declare function decodeHTML(str: string): string;
|
||||
export declare function decodeHTMLStrict(str: string): string;
|
||||
export declare function decodeXML(str: string): string;
|
||||
//# sourceMappingURL=decode.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../src/decode.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAC1D,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAIxD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;AAczC,oBAAY,YAAY;IACpB,SAAS,QAAwB;IACjC,aAAa,QAAwB;IACrC,UAAU,MAAwB;IAClC,UAAU,MAAwB;CACrC;AAED,eAAO,MAAM,gBAAgB,QAAqB,CAAC;AAmGnD,wBAAgB,eAAe,CAC3B,UAAU,EAAE,WAAW,EACvB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACb,MAAM,CA0CR;AAKD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C"}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.decodeXML = exports.decodeHTMLStrict = exports.decodeHTML = exports.determineBranch = exports.JUMP_OFFSET_BASE = exports.BinTrieFlags = exports.xmlDecodeTree = exports.htmlDecodeTree = void 0;
|
||||
var decode_data_html_1 = __importDefault(require("./generated/decode-data-html"));
|
||||
exports.htmlDecodeTree = decode_data_html_1.default;
|
||||
var decode_data_xml_1 = __importDefault(require("./generated/decode-data-xml"));
|
||||
exports.xmlDecodeTree = decode_data_xml_1.default;
|
||||
var decode_codepoint_1 = __importDefault(require("./decode_codepoint"));
|
||||
var BinTrieFlags;
|
||||
(function (BinTrieFlags) {
|
||||
BinTrieFlags[BinTrieFlags["HAS_VALUE"] = 32768] = "HAS_VALUE";
|
||||
BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 32512] = "BRANCH_LENGTH";
|
||||
BinTrieFlags[BinTrieFlags["MULTI_BYTE"] = 128] = "MULTI_BYTE";
|
||||
BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE";
|
||||
})(BinTrieFlags = exports.BinTrieFlags || (exports.BinTrieFlags = {}));
|
||||
exports.JUMP_OFFSET_BASE = 48 /* ZERO */ - 1;
|
||||
function getDecoder(decodeTree) {
|
||||
return function decodeHTMLBinary(str, strict) {
|
||||
var ret = "";
|
||||
var lastIdx = 0;
|
||||
var strIdx = 0;
|
||||
while ((strIdx = str.indexOf("&", strIdx)) >= 0) {
|
||||
ret += str.slice(lastIdx, strIdx);
|
||||
lastIdx = strIdx;
|
||||
// Skip the "&"
|
||||
strIdx += 1;
|
||||
// If we have a numeric entity, handle this separately.
|
||||
if (str.charCodeAt(strIdx) === 35 /* NUM */) {
|
||||
// Skip the leading "&#". For hex entities, also skip the leading "x".
|
||||
var start = strIdx + 1;
|
||||
var base = 10;
|
||||
var cp = str.charCodeAt(start);
|
||||
if ((cp | 32 /* To_LOWER_BIT */) === 120 /* LOWER_X */) {
|
||||
base = 16;
|
||||
strIdx += 1;
|
||||
start += 1;
|
||||
}
|
||||
while (((cp = str.charCodeAt(++strIdx)) >= 48 /* ZERO */ &&
|
||||
cp <= 57 /* NINE */) ||
|
||||
(base === 16 &&
|
||||
(cp | 32 /* To_LOWER_BIT */) >= 97 /* LOWER_A */ &&
|
||||
(cp | 32 /* To_LOWER_BIT */) <= 102 /* LOWER_F */))
|
||||
;
|
||||
if (start !== strIdx) {
|
||||
var entity = str.substring(start, strIdx);
|
||||
var parsed = parseInt(entity, base);
|
||||
if (str.charCodeAt(strIdx) === 59 /* SEMI */) {
|
||||
strIdx += 1;
|
||||
}
|
||||
else if (strict) {
|
||||
continue;
|
||||
}
|
||||
ret += decode_codepoint_1.default(parsed);
|
||||
lastIdx = strIdx;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
var result = null;
|
||||
var excess = 1;
|
||||
var treeIdx = 0;
|
||||
var current = decodeTree[treeIdx];
|
||||
for (; strIdx < str.length; strIdx++, excess++) {
|
||||
treeIdx = determineBranch(decodeTree, current, treeIdx + 1, str.charCodeAt(strIdx));
|
||||
if (treeIdx < 0)
|
||||
break;
|
||||
current = decodeTree[treeIdx];
|
||||
// If the branch is a value, store it and continue
|
||||
if (current & BinTrieFlags.HAS_VALUE) {
|
||||
// If we have a legacy entity while parsing strictly, just skip the number of bytes
|
||||
if (strict && str.charCodeAt(strIdx) !== 59 /* SEMI */) {
|
||||
// No need to consider multi-byte values, as the legacy entity is always a single byte
|
||||
treeIdx += 1;
|
||||
}
|
||||
else {
|
||||
// If this is a surrogate pair, combine the higher bits from the node with the next byte
|
||||
result =
|
||||
current & BinTrieFlags.MULTI_BYTE
|
||||
? String.fromCharCode(decodeTree[++treeIdx], decodeTree[++treeIdx])
|
||||
: String.fromCharCode(decodeTree[++treeIdx]);
|
||||
excess = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result != null) {
|
||||
ret += result;
|
||||
lastIdx = strIdx - excess + 1;
|
||||
}
|
||||
}
|
||||
return ret + str.slice(lastIdx);
|
||||
};
|
||||
}
|
||||
function determineBranch(decodeTree, current, nodeIdx, char) {
|
||||
if (current <= 128) {
|
||||
return char === current ? nodeIdx : -1;
|
||||
}
|
||||
var branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 8;
|
||||
if (branchCount === 0) {
|
||||
return -1;
|
||||
}
|
||||
if (branchCount === 1) {
|
||||
return char === decodeTree[nodeIdx] ? nodeIdx + 1 : -1;
|
||||
}
|
||||
var jumpOffset = current & BinTrieFlags.JUMP_TABLE;
|
||||
if (jumpOffset) {
|
||||
var value = char - exports.JUMP_OFFSET_BASE - jumpOffset;
|
||||
return value < 0 || value > branchCount
|
||||
? -1
|
||||
: decodeTree[nodeIdx + value] - 1;
|
||||
}
|
||||
// Binary search for the character.
|
||||
var lo = nodeIdx;
|
||||
var hi = lo + branchCount - 1;
|
||||
while (lo <= hi) {
|
||||
var mid = (lo + hi) >>> 1;
|
||||
var midVal = decodeTree[mid];
|
||||
if (midVal < char) {
|
||||
lo = mid + 1;
|
||||
}
|
||||
else if (midVal > char) {
|
||||
hi = mid - 1;
|
||||
}
|
||||
else {
|
||||
return decodeTree[mid + branchCount];
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
exports.determineBranch = determineBranch;
|
||||
var htmlDecoder = getDecoder(decode_data_html_1.default);
|
||||
var xmlDecoder = getDecoder(decode_data_xml_1.default);
|
||||
function decodeHTML(str) {
|
||||
return htmlDecoder(str, false);
|
||||
}
|
||||
exports.decodeHTML = decodeHTML;
|
||||
function decodeHTMLStrict(str) {
|
||||
return htmlDecoder(str, true);
|
||||
}
|
||||
exports.decodeHTMLStrict = decodeHTMLStrict;
|
||||
function decodeXML(str) {
|
||||
return xmlDecoder(str, true);
|
||||
}
|
||||
exports.decodeXML = decodeXML;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export default function decodeCodePoint(codePoint: number): string;
|
||||
//# sourceMappingURL=decode_codepoint.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"decode_codepoint.d.ts","sourceRoot":"","sources":["../src/decode_codepoint.ts"],"names":[],"mappings":"AAmDA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAMjE"}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
// Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var decodeMap = new Map([
|
||||
[0, 65533],
|
||||
[128, 8364],
|
||||
[130, 8218],
|
||||
[131, 402],
|
||||
[132, 8222],
|
||||
[133, 8230],
|
||||
[134, 8224],
|
||||
[135, 8225],
|
||||
[136, 710],
|
||||
[137, 8240],
|
||||
[138, 352],
|
||||
[139, 8249],
|
||||
[140, 338],
|
||||
[142, 381],
|
||||
[145, 8216],
|
||||
[146, 8217],
|
||||
[147, 8220],
|
||||
[148, 8221],
|
||||
[149, 8226],
|
||||
[150, 8211],
|
||||
[151, 8212],
|
||||
[152, 732],
|
||||
[153, 8482],
|
||||
[154, 353],
|
||||
[155, 8250],
|
||||
[156, 339],
|
||||
[158, 382],
|
||||
[159, 376],
|
||||
]);
|
||||
var fromCodePoint =
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
|
||||
String.fromCodePoint ||
|
||||
function (codePoint) {
|
||||
var output = "";
|
||||
if (codePoint > 0xffff) {
|
||||
codePoint -= 0x10000;
|
||||
output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800);
|
||||
codePoint = 0xdc00 | (codePoint & 0x3ff);
|
||||
}
|
||||
output += String.fromCharCode(codePoint);
|
||||
return output;
|
||||
};
|
||||
function decodeCodePoint(codePoint) {
|
||||
var _a;
|
||||
if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
|
||||
return "\uFFFD";
|
||||
}
|
||||
return fromCodePoint((_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint);
|
||||
}
|
||||
exports.default = decodeCodePoint;
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
export declare const getCodePoint: (str: string, index: number) => number;
|
||||
export declare function encodeHTMLTrieRe(regExp: RegExp, str: string): string;
|
||||
export interface TrieNode {
|
||||
value?: string;
|
||||
next?: Map<number, TrieNode>;
|
||||
}
|
||||
export declare function getTrie(map: Record<string, string>): Map<number, TrieNode>;
|
||||
//# sourceMappingURL=encode-trie.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"encode-trie.d.ts","sourceRoot":"","sources":["../src/encode-trie.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,YAAY,QAGT,MAAM,SAAS,MAAM,KAAG,MAQD,CAAC;AAIxC,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAkCpE;AAED,MAAM,WAAW,QAAQ;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CAChC;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAmB1E"}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getTrie = exports.encodeHTMLTrieRe = exports.getCodePoint = void 0;
|
||||
var entities_json_1 = __importDefault(require("./maps/entities.json"));
|
||||
function isHighSurrugate(c) {
|
||||
return (c & 64512 /* Mask */) === 55296 /* High */;
|
||||
}
|
||||
// For compatibility with node < 4, we wrap `codePointAt`
|
||||
exports.getCodePoint =
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
String.prototype.codePointAt != null
|
||||
? function (str, index) { return str.codePointAt(index); }
|
||||
: // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
||||
function (c, index) {
|
||||
return isHighSurrugate(c.charCodeAt(index))
|
||||
? (c.charCodeAt(index) - 55296 /* High */) * 0x400 +
|
||||
c.charCodeAt(index + 1) -
|
||||
0xdc00 +
|
||||
0x10000
|
||||
: c.charCodeAt(index);
|
||||
};
|
||||
var htmlTrie = getTrie(entities_json_1.default);
|
||||
function encodeHTMLTrieRe(regExp, str) {
|
||||
var _a;
|
||||
var ret = "";
|
||||
var lastIdx = 0;
|
||||
var match;
|
||||
while ((match = regExp.exec(str)) !== null) {
|
||||
var i = match.index;
|
||||
var char = str.charCodeAt(i);
|
||||
var next = htmlTrie.get(char);
|
||||
if (next) {
|
||||
if (next.next != null && i + 1 < str.length) {
|
||||
var value = (_a = next.next.get(str.charCodeAt(i + 1))) === null || _a === void 0 ? void 0 : _a.value;
|
||||
if (value != null) {
|
||||
ret += str.substring(lastIdx, i) + value;
|
||||
regExp.lastIndex += 1;
|
||||
lastIdx = i + 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ret += str.substring(lastIdx, i) + next.value;
|
||||
lastIdx = i + 1;
|
||||
}
|
||||
else {
|
||||
ret += str.substring(lastIdx, i) + "&#x" + exports.getCodePoint(str, i).toString(16) + ";";
|
||||
// Increase by 1 if we have a surrogate pair
|
||||
lastIdx = regExp.lastIndex += Number(isHighSurrugate(char));
|
||||
}
|
||||
}
|
||||
return ret + str.substr(lastIdx);
|
||||
}
|
||||
exports.encodeHTMLTrieRe = encodeHTMLTrieRe;
|
||||
function getTrie(map) {
|
||||
var _a, _b, _c, _d;
|
||||
var trie = new Map();
|
||||
for (var _i = 0, _e = Object.keys(map); _i < _e.length; _i++) {
|
||||
var value = _e[_i];
|
||||
var key = map[value];
|
||||
// Resolve the key
|
||||
var lastMap = trie;
|
||||
for (var i = 0; i < key.length - 1; i++) {
|
||||
var char = key.charCodeAt(i);
|
||||
var next = (_a = lastMap.get(char)) !== null && _a !== void 0 ? _a : {};
|
||||
lastMap.set(char, next);
|
||||
lastMap = (_b = next.next) !== null && _b !== void 0 ? _b : (next.next = new Map());
|
||||
}
|
||||
var val = (_c = lastMap.get(key.charCodeAt(key.length - 1))) !== null && _c !== void 0 ? _c : {};
|
||||
(_d = val.value) !== null && _d !== void 0 ? _d : (val.value = "&" + value + ";");
|
||||
lastMap.set(key.charCodeAt(key.length - 1), val);
|
||||
}
|
||||
return trie;
|
||||
}
|
||||
exports.getTrie = getTrie;
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Encodes all non-ASCII characters, as well as characters not valid in XML
|
||||
* documents using XML entities.
|
||||
*
|
||||
* If a character has no equivalent entity, a
|
||||
* numeric hexadecimal reference (eg. `ü`) will be used.
|
||||
*/
|
||||
export declare function encodeXML(str: string): string;
|
||||
/**
|
||||
* Encodes all entities and non-ASCII characters in the input.
|
||||
*
|
||||
* This includes characters that are valid ASCII characters in HTML documents.
|
||||
* For example `#` will be encoded as `#`. To get a more compact output,
|
||||
* consider using the `encodeNonAsciiHTML` function.
|
||||
*
|
||||
* If a character has no equivalent entity, a
|
||||
* numeric hexadecimal reference (eg. `ü`) will be used.
|
||||
*/
|
||||
export declare function encodeHTML(data: string): string;
|
||||
/**
|
||||
* Encodes all non-ASCII characters, as well as characters not valid in HTML
|
||||
* documents using HTML entities.
|
||||
*
|
||||
* If a character has no equivalent entity, a
|
||||
* numeric hexadecimal reference (eg. `ü`) will be used.
|
||||
*/
|
||||
export declare function encodeNonAsciiHTML(data: string): string;
|
||||
/**
|
||||
* Encodes all non-ASCII characters, as well as characters not valid in XML
|
||||
* documents using numeric hexadecimal reference (eg. `ü`).
|
||||
*
|
||||
* Have a look at `escapeUTF8` if you want a more concise output at the expense
|
||||
* of reduced transportability.
|
||||
*
|
||||
* @param data String to escape.
|
||||
*/
|
||||
export declare const escape: typeof encodeXML;
|
||||
/**
|
||||
* Encodes all characters not valid in XML documents using XML entities.
|
||||
*
|
||||
* Note that the output will be character-set dependent.
|
||||
*
|
||||
* @param data String to escape.
|
||||
*/
|
||||
export declare function escapeUTF8(data: string): string;
|
||||
//# sourceMappingURL=encode.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../src/encode.ts"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA0B7C;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AACD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAoCD;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,kBAAY,CAAC;AAEhC;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkB/C"}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = void 0;
|
||||
var xml_json_1 = __importDefault(require("./maps/xml.json"));
|
||||
var encode_trie_1 = require("./encode-trie");
|
||||
var entities_json_1 = __importDefault(require("./maps/entities.json"));
|
||||
var htmlReplacer = getCharRegExp(entities_json_1.default, true);
|
||||
var xmlReplacer = getCharRegExp(xml_json_1.default, true);
|
||||
var xmlInvalidChars = getCharRegExp(xml_json_1.default, false);
|
||||
var xmlCodeMap = new Map(Object.keys(xml_json_1.default).map(function (k) { return [
|
||||
xml_json_1.default[k].charCodeAt(0),
|
||||
"&" + k + ";",
|
||||
]; }));
|
||||
/**
|
||||
* Encodes all non-ASCII characters, as well as characters not valid in XML
|
||||
* documents using XML entities.
|
||||
*
|
||||
* If a character has no equivalent entity, a
|
||||
* numeric hexadecimal reference (eg. `ü`) will be used.
|
||||
*/
|
||||
function encodeXML(str) {
|
||||
var ret = "";
|
||||
var lastIdx = 0;
|
||||
var match;
|
||||
while ((match = xmlReplacer.exec(str)) !== null) {
|
||||
var i = match.index;
|
||||
var char = str.charCodeAt(i);
|
||||
var next = xmlCodeMap.get(char);
|
||||
if (next) {
|
||||
ret += str.substring(lastIdx, i) + next;
|
||||
lastIdx = i + 1;
|
||||
}
|
||||
else {
|
||||
ret += str.substring(lastIdx, i) + "&#x" + encode_trie_1.getCodePoint(str, i).toString(16) + ";";
|
||||
// Increase by 1 if we have a surrogate pair
|
||||
lastIdx = xmlReplacer.lastIndex += Number((char & 65408) === 0xd800);
|
||||
}
|
||||
}
|
||||
return ret + str.substr(lastIdx);
|
||||
}
|
||||
exports.encodeXML = encodeXML;
|
||||
/**
|
||||
* Encodes all entities and non-ASCII characters in the input.
|
||||
*
|
||||
* This includes characters that are valid ASCII characters in HTML documents.
|
||||
* For example `#` will be encoded as `#`. To get a more compact output,
|
||||
* consider using the `encodeNonAsciiHTML` function.
|
||||
*
|
||||
* If a character has no equivalent entity, a
|
||||
* numeric hexadecimal reference (eg. `ü`) will be used.
|
||||
*/
|
||||
function encodeHTML(data) {
|
||||
return encode_trie_1.encodeHTMLTrieRe(htmlReplacer, data);
|
||||
}
|
||||
exports.encodeHTML = encodeHTML;
|
||||
/**
|
||||
* Encodes all non-ASCII characters, as well as characters not valid in HTML
|
||||
* documents using HTML entities.
|
||||
*
|
||||
* If a character has no equivalent entity, a
|
||||
* numeric hexadecimal reference (eg. `ü`) will be used.
|
||||
*/
|
||||
function encodeNonAsciiHTML(data) {
|
||||
return encode_trie_1.encodeHTMLTrieRe(xmlReplacer, data);
|
||||
}
|
||||
exports.encodeNonAsciiHTML = encodeNonAsciiHTML;
|
||||
function getCharRegExp(map, nonAscii) {
|
||||
// Collect the start characters of all entities
|
||||
var chars = Object.keys(map)
|
||||
.map(function (k) { return "\\" + map[k].charAt(0); })
|
||||
.filter(function (v) { return !nonAscii || v.charCodeAt(1) < 128; })
|
||||
.sort(function (a, b) { return a.charCodeAt(1) - b.charCodeAt(1); })
|
||||
// Remove duplicates
|
||||
.filter(function (v, i, a) { return v !== a[i + 1]; });
|
||||
// Add ranges to single characters.
|
||||
for (var start = 0; start < chars.length - 1; start++) {
|
||||
// Find the end of a run of characters
|
||||
var end = start;
|
||||
while (end < chars.length - 1 &&
|
||||
chars[end].charCodeAt(1) + 1 === chars[end + 1].charCodeAt(1)) {
|
||||
end += 1;
|
||||
}
|
||||
var count = 1 + end - start;
|
||||
// We want to replace at least three characters
|
||||
if (count < 3)
|
||||
continue;
|
||||
chars.splice(start, count, chars[start] + "-" + chars[end]);
|
||||
}
|
||||
return new RegExp("[" + chars.join("") + (nonAscii ? "\\x80-\\uFFFF" : "") + "]", "g");
|
||||
}
|
||||
/**
|
||||
* Encodes all non-ASCII characters, as well as characters not valid in XML
|
||||
* documents using numeric hexadecimal reference (eg. `ü`).
|
||||
*
|
||||
* Have a look at `escapeUTF8` if you want a more concise output at the expense
|
||||
* of reduced transportability.
|
||||
*
|
||||
* @param data String to escape.
|
||||
*/
|
||||
exports.escape = encodeXML;
|
||||
/**
|
||||
* Encodes all characters not valid in XML documents using XML entities.
|
||||
*
|
||||
* Note that the output will be character-set dependent.
|
||||
*
|
||||
* @param data String to escape.
|
||||
*/
|
||||
function escapeUTF8(data) {
|
||||
var match;
|
||||
var lastIdx = 0;
|
||||
var result = "";
|
||||
while ((match = xmlInvalidChars.exec(data))) {
|
||||
if (lastIdx !== match.index) {
|
||||
result += data.substring(lastIdx, match.index);
|
||||
}
|
||||
// We know that this chararcter will be in `inverseXML`
|
||||
result += xmlCodeMap.get(match[0].charCodeAt(0));
|
||||
// Every match will be of length 1
|
||||
lastIdx = match.index + 1;
|
||||
}
|
||||
return result + data.substring(lastIdx);
|
||||
}
|
||||
exports.escapeUTF8 = escapeUTF8;
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
declare const _default: Uint16Array;
|
||||
export default _default;
|
||||
//# sourceMappingURL=decode-data-html.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"decode-data-html.d.ts","sourceRoot":"","sources":["../../src/generated/decode-data-html.ts"],"names":[],"mappings":";AAEA,wBAAox9E"}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// Generated using scripts/write-decode-map.ts
|
||||
// prettier-ignore
|
||||
exports.default = new Uint16Array([14866, 60, 237, 340, 721, 1312, 1562, 1654, 1838, 1957, 2183, 2239, 2301, 2958, 3037, 3893, 4123, 4298, 4330, 4801, 5191, 5395, 5752, 5903, 5943, 5972, 6050, 0, 0, 0, 0, 0, 0, 6135, 6565, 7422, 8183, 8738, 9242, 9503, 9938, 10189, 10573, 10637, 10715, 11950, 12246, 13539, 13950, 14445, 14533, 15364, 16514, 16980, 17390, 17763, 17849, 18036, 18125, 4096, 69, 77, 97, 98, 99, 102, 103, 108, 109, 110, 111, 112, 114, 115, 116, 117, 92, 100, 106, 115, 122, 137, 142, 151, 157, 163, 167, 182, 196, 204, 220, 229, 108, 105, 103, 33024, 198, 59, 32768, 198, 80, 33024, 38, 59, 32768, 38, 99, 117, 116, 101, 33024, 193, 59, 32768, 193, 114, 101, 118, 101, 59, 32768, 258, 512, 105, 121, 127, 134, 114, 99, 33024, 194, 59, 32768, 194, 59, 32768, 1040, 114, 59, 32896, 55349, 56580, 114, 97, 118, 101, 33024, 192, 59, 32768, 192, 112, 104, 97, 59, 32768, 913, 97, 99, 114, 59, 32768, 256, 100, 59, 32768, 10835, 512, 103, 112, 172, 177, 111, 110, 59, 32768, 260, 102, 59, 32896, 55349, 56632, 112, 108, 121, 70, 117, 110, 99, 116, 105, 111, 110, 59, 32768, 8289, 105, 110, 103, 33024, 197, 59, 32768, 197, 512, 99, 115, 209, 214, 114, 59, 32896, 55349, 56476, 105, 103, 110, 59, 32768, 8788, 105, 108, 100, 101, 33024, 195, 59, 32768, 195, 109, 108, 33024, 196, 59, 32768, 196, 2048, 97, 99, 101, 102, 111, 114, 115, 117, 253, 278, 282, 310, 315, 321, 327, 332, 512, 99, 114, 258, 267, 107, 115, 108, 97, 115, 104, 59, 32768, 8726, 583, 271, 274, 59, 32768, 10983, 101, 100, 59, 32768, 8966, 121, 59, 32768, 1041, 768, 99, 114, 116, 289, 296, 306, 97, 117, 115, 101, 59, 32768, 8757, 110, 111, 117, 108, 108, 105, 115, 59, 32768, 8492, 97, 59, 32768, 914, 114, 59, 32896, 55349, 56581, 112, 102, 59, 32896, 55349, 56633, 101, 118, 101, 59, 32768, 728, 99, 114, 59, 32768, 8492, 109, 112, 101, 113, 59, 32768, 8782, 3584, 72, 79, 97, 99, 100, 101, 102, 104, 105, 108, 111, 114, 115, 117, 368, 373, 380, 426, 461, 466, 487, 491, 495, 533, 593, 695, 701, 707, 99, 121, 59, 32768, 1063, 80, 89, 33024, 169, 59, 32768, 169, 768, 99, 112, 121, 387, 393, 419, 117, 116, 101, 59, 32768, 262, 512, 59, 105, 398, 400, 32768, 8914, 116, 97, 108, 68, 105, 102, 102, 101, 114, 101, 110, 116, 105, 97, 108, 68, 59, 32768, 8517, 108, 101, 121, 115, 59, 32768, 8493, 1024, 97, 101, 105, 111, 435, 441, 449, 454, 114, 111, 110, 59, 32768, 268, 100, 105, 108, 33024, 199, 59, 32768, 199, 114, 99, 59, 32768, 264, 110, 105, 110, 116, 59, 32768, 8752, 111, 116, 59, 32768, 266, 512, 100, 110, 471, 478, 105, 108, 108, 97, 59, 32768, 184, 116, 101, 114, 68, 111, 116, 59, 32768, 183, 114, 59, 32768, 8493, 105, 59, 32768, 935, 114, 99, 108, 101, 1024, 68, 77, 80, 84, 508, 513, 520, 526, 111, 116, 59, 32768, 8857, 105, 110, 117, 115, 59, 32768, 8854, 108, 117, 115, 59, 32768, 8853, 105, 109, 101, 115, 59, 32768, 8855, 111, 512, 99, 115, 539, 562, 107, 119, 105, 115, 101, 67, 111, 110, 116, 111, 117, 114, 73, 110, 116, 101, 103, 114, 97, 108, 59, 32768, 8754, 101, 67, 117, 114, 108, 121, 512, 68, 81, 573, 586, 111, 117, 98, 108, 101, 81, 117, 111, 116, 101, 59, 32768, 8221, 117, 111, 116, 101, 59, 32768, 8217, 1024, 108, 110, 112, 117, 602, 614, 648, 664, 111, 110, 512, 59, 101, 609, 611, 32768, 8759, 59, 32768, 10868, 768, 103, 105, 116, 621, 629, 634, 114, 117, 101, 110, 116, 59, 32768, 8801, 110, 116, 59, 32768, 8751, 111, 117, 114, 73, 110, 116, 101, 103, 114, 97, 108, 59, 32768, 8750, 512, 102, 114, 653, 656, 59, 32768, 8450, 111, 100, 117, 99, 116, 59, 32768, 8720, 110, 116, 101, 114, 67, 108, 111, 99, 107, 119, 105, 115, 101, 67, 111, 110, 116, 111, 117, 114, 73, 110, 116, 101, 103, 114, 97, 108, 59, 32768, 8755, 111, 115, 115, 59, 32768, 10799, 99, 114, 59, 32896, 55349, 56478, 112, 512, 59, 67, 713, 715, 32768, 8915, 97, 112, 59, 32768, 8781, 2816, 68, 74, 83, 90, 97, 99, 101, 102, 105, 111, 115, 743, 758, 763, 768, 773, 795, 809, 821, 826, 910, 1295, 512, 59, 111, 748, 750, 32768, 8517, 116, 114, 97, 104, 100, 59, 32768, 10513, 99, 121, 59, 32768, 1026, 99, 121, 59, 32768, 1029, 99, 121, 59, 32768, 1039, 768, 103, 114, 115, 780, 786, 790, 103, 101, 114, 59, 32768, 8225, 114, 59, 32768, 8609, 104, 118, 59, 32768, 10980, 512, 97, 121, 800, 806, 114, 111, 110, 59, 32768, 270, 59, 32768, 1044, 108, 512, 59, 116, 815, 817, 32768, 8711, 97, 59, 32768, 916, 114, 59, 32896, 55349, 56583, 512, 97, 102, 831, 897, 512, 99, 109, 836, 891, 114, 105, 116, 105, 99, 97, 108, 1024, 65, 68, 71, 84, 852, 859, 877, 884, 99, 117, 116, 101, 59, 32768, 180, 111, 581, 864, 867, 59, 32768, 729, 98, 108, 101, 65, 99, 117, 116, 101, 59, 32768, 733, 114, 97, 118, 101, 59, 32768, 96, 105, 108, 100, 101, 59, 32768, 732, 111, 110, 100, 59, 32768, 8900, 102, 101, 114, 101, 110, 116, 105, 97, 108, 68, 59, 32768, 8518, 2113, 920, 0, 0, 0, 925, 946, 0, 1139, 102, 59, 32896, 55349, 56635, 768, 59, 68, 69, 931, 933, 938, 32768, 168, 111, 116, 59, 32768, 8412, 113, 117, 97, 108, 59, 32768, 8784, 98, 108, 101, 1536, 67, 68, 76, 82, 85, 86, 961, 978, 996, 1080, 1101, 1125, 111,
Line truncated
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
declare const _default: Uint16Array;
|
||||
export default _default;
|
||||
//# sourceMappingURL=decode-data-xml.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"decode-data-xml.d.ts","sourceRoot":"","sources":["../../src/generated/decode-data-xml.ts"],"names":[],"mappings":";AAEA,wBAA4K"}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// Generated using scripts/write-decode-map.ts
|
||||
// prettier-ignore
|
||||
exports.default = new Uint16Array([1024, 97, 103, 108, 113, 9, 23, 27, 31, 1086, 15, 0, 0, 19, 112, 59, 32768, 38, 111, 115, 59, 32768, 39, 116, 59, 32768, 62, 116, 59, 32768, 60, 117, 111, 116, 59, 32768, 34]);
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
/** The level of entities to support. */
|
||||
export declare enum EntityLevel {
|
||||
/** Support only XML entities. */
|
||||
XML = 0,
|
||||
/** Support HTML entities, which are a superset of XML entities. */
|
||||
HTML = 1
|
||||
}
|
||||
/** Determines whether some entities are allowed to be written without a trailing `;`. */
|
||||
export declare enum DecodingMode {
|
||||
/** Support legacy HTML entities. */
|
||||
Legacy = 0,
|
||||
/** Do not support legacy HTML entities. */
|
||||
Strict = 1
|
||||
}
|
||||
export declare enum EncodingMode {
|
||||
/**
|
||||
* The output is UTF-8 encoded. Only characters that need escaping within
|
||||
* HTML will be escaped.
|
||||
*/
|
||||
UTF8 = 0,
|
||||
/**
|
||||
* The output consists only of ASCII characters. Characters that need
|
||||
* escaping within HTML, and characters that aren't ASCII characters will
|
||||
* be escaped.
|
||||
*/
|
||||
ASCII = 1,
|
||||
/**
|
||||
* Encode all characters that have an equivalent entity, as well as all
|
||||
* characters that are not ASCII characters.
|
||||
*/
|
||||
Extensive = 2
|
||||
}
|
||||
interface DecodingOptions {
|
||||
/**
|
||||
* The level of entities to support.
|
||||
* @default EntityLevel.XML
|
||||
*/
|
||||
level?: EntityLevel;
|
||||
/**
|
||||
* Decoding mode. If `Legacy`, will support legacy entities not terminated
|
||||
* with a semicolon (`;`).
|
||||
*
|
||||
* Always `Strict` for XML. For HTML, set this to `true` if you are parsing
|
||||
* an attribute value.
|
||||
*
|
||||
* The deprecated `decodeStrict` function defaults this to `Strict`.
|
||||
*
|
||||
* @default DecodingMode.Legacy
|
||||
*/
|
||||
mode?: DecodingMode;
|
||||
}
|
||||
/**
|
||||
* Decodes a string with entities.
|
||||
*
|
||||
* @param data String to decode.
|
||||
* @param options Decoding options.
|
||||
*/
|
||||
export declare function decode(data: string, options?: DecodingOptions | EntityLevel): string;
|
||||
/**
|
||||
* Decodes a string with entities. Does not allow missing trailing semicolons for entities.
|
||||
*
|
||||
* @param data String to decode.
|
||||
* @param options Decoding options.
|
||||
* @deprecated Use `decode` with the `mode` set to `Strict`.
|
||||
*/
|
||||
export declare function decodeStrict(data: string, options?: DecodingOptions | EntityLevel): string;
|
||||
/**
|
||||
* Options for `encode`.
|
||||
*/
|
||||
export interface EncodingOptions {
|
||||
/**
|
||||
* The level of entities to support.
|
||||
* @default EntityLevel.XML
|
||||
*/
|
||||
level?: EntityLevel;
|
||||
/**
|
||||
* Output format.
|
||||
* @default EncodingMode.Extensive
|
||||
*/
|
||||
mode?: EncodingMode;
|
||||
}
|
||||
/**
|
||||
* Encodes a string with entities.
|
||||
*
|
||||
* @param data String to encode.
|
||||
* @param options Encoding options.
|
||||
*/
|
||||
export declare function encode(data: string, options?: EncodingOptions | EntityLevel): string;
|
||||
export { encodeXML, encodeHTML, encodeNonAsciiHTML, escape, escapeUTF8, encodeHTML as encodeHTML4, encodeHTML as encodeHTML5, } from "./encode";
|
||||
export { decodeXML, decodeHTML, decodeHTMLStrict, decodeHTML as decodeHTML4, decodeHTML as decodeHTML5, decodeHTMLStrict as decodeHTML4Strict, decodeHTMLStrict as decodeHTML5Strict, decodeXML as decodeXMLStrict, } from "./decode";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,wCAAwC;AACxC,oBAAY,WAAW;IACnB,iCAAiC;IACjC,GAAG,IAAI;IACP,mEAAmE;IACnE,IAAI,IAAI;CACX;AAED,yFAAyF;AACzF,oBAAY,YAAY;IACpB,oCAAoC;IACpC,MAAM,IAAI;IACV,2CAA2C;IAC3C,MAAM,IAAI;CACb;AAED,oBAAY,YAAY;IACpB;;;OAGG;IACH,IAAI,IAAA;IACJ;;;;OAIG;IACH,KAAK,IAAA;IACL;;;OAGG;IACH,SAAS,IAAA;CACZ;AAED,UAAU,eAAe;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAe,GAAG,WAA6B,GACzD,MAAM,CAWR;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAe,GAAG,WAA6B,GACzD,MAAM,CAWR;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAe,GAAG,WAA6B,GACzD,MAAM,CAgBR;AAED,OAAO,EACH,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,MAAM,EACN,UAAU,EAEV,UAAU,IAAI,WAAW,EACzB,UAAU,IAAI,WAAW,GAC5B,MAAM,UAAU,CAAC;AAElB,OAAO,EACH,SAAS,EACT,UAAU,EACV,gBAAgB,EAEhB,UAAU,IAAI,WAAW,EACzB,UAAU,IAAI,WAAW,EACzB,gBAAgB,IAAI,iBAAiB,EACrC,gBAAgB,IAAI,iBAAiB,EACrC,SAAS,IAAI,eAAe,GAC/B,MAAM,UAAU,CAAC"}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.encodeHTML5 = exports.encodeHTML4 = exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = exports.encode = exports.decodeStrict = exports.decode = exports.EncodingMode = exports.DecodingMode = exports.EntityLevel = void 0;
|
||||
var decode_1 = require("./decode");
|
||||
var encode_1 = require("./encode");
|
||||
/** The level of entities to support. */
|
||||
var EntityLevel;
|
||||
(function (EntityLevel) {
|
||||
/** Support only XML entities. */
|
||||
EntityLevel[EntityLevel["XML"] = 0] = "XML";
|
||||
/** Support HTML entities, which are a superset of XML entities. */
|
||||
EntityLevel[EntityLevel["HTML"] = 1] = "HTML";
|
||||
})(EntityLevel = exports.EntityLevel || (exports.EntityLevel = {}));
|
||||
/** Determines whether some entities are allowed to be written without a trailing `;`. */
|
||||
var DecodingMode;
|
||||
(function (DecodingMode) {
|
||||
/** Support legacy HTML entities. */
|
||||
DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy";
|
||||
/** Do not support legacy HTML entities. */
|
||||
DecodingMode[DecodingMode["Strict"] = 1] = "Strict";
|
||||
})(DecodingMode = exports.DecodingMode || (exports.DecodingMode = {}));
|
||||
var EncodingMode;
|
||||
(function (EncodingMode) {
|
||||
/**
|
||||
* The output is UTF-8 encoded. Only characters that need escaping within
|
||||
* HTML will be escaped.
|
||||
*/
|
||||
EncodingMode[EncodingMode["UTF8"] = 0] = "UTF8";
|
||||
/**
|
||||
* The output consists only of ASCII characters. Characters that need
|
||||
* escaping within HTML, and characters that aren't ASCII characters will
|
||||
* be escaped.
|
||||
*/
|
||||
EncodingMode[EncodingMode["ASCII"] = 1] = "ASCII";
|
||||
/**
|
||||
* Encode all characters that have an equivalent entity, as well as all
|
||||
* characters that are not ASCII characters.
|
||||
*/
|
||||
EncodingMode[EncodingMode["Extensive"] = 2] = "Extensive";
|
||||
})(EncodingMode = exports.EncodingMode || (exports.EncodingMode = {}));
|
||||
/**
|
||||
* Decodes a string with entities.
|
||||
*
|
||||
* @param data String to decode.
|
||||
* @param options Decoding options.
|
||||
*/
|
||||
function decode(data, options) {
|
||||
if (options === void 0) { options = EntityLevel.XML; }
|
||||
var opts = typeof options === "number" ? { level: options } : options;
|
||||
if (opts.level === EntityLevel.HTML) {
|
||||
if (opts.mode === DecodingMode.Strict) {
|
||||
return decode_1.decodeHTMLStrict(data);
|
||||
}
|
||||
return decode_1.decodeHTML(data);
|
||||
}
|
||||
return decode_1.decodeXML(data);
|
||||
}
|
||||
exports.decode = decode;
|
||||
/**
|
||||
* Decodes a string with entities. Does not allow missing trailing semicolons for entities.
|
||||
*
|
||||
* @param data String to decode.
|
||||
* @param options Decoding options.
|
||||
* @deprecated Use `decode` with the `mode` set to `Strict`.
|
||||
*/
|
||||
function decodeStrict(data, options) {
|
||||
if (options === void 0) { options = EntityLevel.XML; }
|
||||
var opts = typeof options === "number" ? { level: options } : options;
|
||||
if (opts.level === EntityLevel.HTML) {
|
||||
if (opts.mode === DecodingMode.Legacy) {
|
||||
return decode_1.decodeHTML(data);
|
||||
}
|
||||
return decode_1.decodeHTMLStrict(data);
|
||||
}
|
||||
return decode_1.decodeXML(data);
|
||||
}
|
||||
exports.decodeStrict = decodeStrict;
|
||||
/**
|
||||
* Encodes a string with entities.
|
||||
*
|
||||
* @param data String to encode.
|
||||
* @param options Encoding options.
|
||||
*/
|
||||
function encode(data, options) {
|
||||
if (options === void 0) { options = EntityLevel.XML; }
|
||||
var opts = typeof options === "number" ? { level: options } : options;
|
||||
// Mode `UTF8` just escapes XML entities
|
||||
if (opts.mode === EncodingMode.UTF8)
|
||||
return encode_1.escapeUTF8(data);
|
||||
if (opts.level === EntityLevel.HTML) {
|
||||
if (opts.mode === EncodingMode.ASCII) {
|
||||
return encode_1.encodeNonAsciiHTML(data);
|
||||
}
|
||||
return encode_1.encodeHTML(data);
|
||||
}
|
||||
// ASCII and Extensive are equivalent
|
||||
return encode_1.encodeXML(data);
|
||||
}
|
||||
exports.encode = encode;
|
||||
var encode_2 = require("./encode");
|
||||
Object.defineProperty(exports, "encodeXML", { enumerable: true, get: function () { return encode_2.encodeXML; } });
|
||||
Object.defineProperty(exports, "encodeHTML", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
|
||||
Object.defineProperty(exports, "encodeNonAsciiHTML", { enumerable: true, get: function () { return encode_2.encodeNonAsciiHTML; } });
|
||||
Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return encode_2.escape; } });
|
||||
Object.defineProperty(exports, "escapeUTF8", { enumerable: true, get: function () { return encode_2.escapeUTF8; } });
|
||||
// Legacy aliases (deprecated)
|
||||
Object.defineProperty(exports, "encodeHTML4", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
|
||||
Object.defineProperty(exports, "encodeHTML5", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
|
||||
var decode_2 = require("./decode");
|
||||
Object.defineProperty(exports, "decodeXML", { enumerable: true, get: function () { return decode_2.decodeXML; } });
|
||||
Object.defineProperty(exports, "decodeHTML", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
|
||||
Object.defineProperty(exports, "decodeHTMLStrict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
|
||||
// Legacy aliases (deprecated)
|
||||
Object.defineProperty(exports, "decodeHTML4", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
|
||||
Object.defineProperty(exports, "decodeHTML5", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
|
||||
Object.defineProperty(exports, "decodeHTML4Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
|
||||
Object.defineProperty(exports, "decodeHTML5Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
|
||||
Object.defineProperty(exports, "decodeXMLStrict", { enumerable: true, get: function () { return decode_2.decodeXML; } });
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"'","ApplyFunction":"","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"¦","bscr":"𝒷","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","centerdot":"·","CenterDot":"·","cfr":"𝔠","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"𝕔","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"©","COPY":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","Line truncated
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"Aacute":"Á","aacute":"á","Acirc":"Â","acirc":"â","acute":"´","AElig":"Æ","aelig":"æ","Agrave":"À","agrave":"à","amp":"&","AMP":"&","Aring":"Å","aring":"å","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","brvbar":"¦","Ccedil":"Ç","ccedil":"ç","cedil":"¸","cent":"¢","copy":"©","COPY":"©","curren":"¤","deg":"°","divide":"÷","Eacute":"É","eacute":"é","Ecirc":"Ê","ecirc":"ê","Egrave":"È","egrave":"è","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","frac12":"½","frac14":"¼","frac34":"¾","gt":">","GT":">","Iacute":"Í","iacute":"í","Icirc":"Î","icirc":"î","iexcl":"¡","Igrave":"Ì","igrave":"ì","iquest":"¿","Iuml":"Ï","iuml":"ï","laquo":"«","lt":"<","LT":"<","macr":"¯","micro":"µ","middot":"·","nbsp":" ","not":"¬","Ntilde":"Ñ","ntilde":"ñ","Oacute":"Ó","oacute":"ó","Ocirc":"Ô","ocirc":"ô","Ograve":"Ò","ograve":"ò","ordf":"ª","ordm":"º","Oslash":"Ø","oslash":"ø","Otilde":"Õ","otilde":"õ","Ouml":"Ö","ouml":"ö","para":"¶","plusmn":"±","pound":"£","quot":"\"","QUOT":"\"","raquo":"»","reg":"®","REG":"®","sect":"§","shy":"","sup1":"¹","sup2":"²","sup3":"³","szlig":"ß","THORN":"Þ","thorn":"þ","times":"×","Uacute":"Ú","uacute":"ú","Ucirc":"Û","ucirc":"û","Ugrave":"Ù","ugrave":"ù","uml":"¨","Uuml":"Ü","uuml":"ü","Yacute":"Ý","yacute":"ý","yen":"¥","yuml":"ÿ"}
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"amp":"&","apos":"'","gt":">","lt":"<","quot":"\""}
|
||||
Reference in new issue
Block a user