mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-02 22:21:01 +01:00
Tidied up HTML Entity operations
This commit is contained in:
parent
a7d4e37851
commit
5a83ef4f48
@ -19,7 +19,7 @@ class FromHTMLEntity extends Operation {
|
|||||||
super();
|
super();
|
||||||
|
|
||||||
this.name = "From HTML Entity";
|
this.name = "From HTML Entity";
|
||||||
this.module = "Default";
|
this.module = "Encodings";
|
||||||
this.description = "Converts HTML entities back to characters<br><br>e.g. <code>&<span>amp;</span></code> becomes <code>&</code>";
|
this.description = "Converts HTML entities back to characters<br><br>e.g. <code>&<span>amp;</span></code> becomes <code>&</code>";
|
||||||
this.infoURL = "https://wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references";
|
this.infoURL = "https://wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references";
|
||||||
this.inputType = "string";
|
this.inputType = "string";
|
||||||
@ -40,7 +40,7 @@ class FromHTMLEntity extends Operation {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
const regex = /&(#?x?[a-zA-Z0-9]{1,8});/g;
|
const regex = /&(#?x?[a-zA-Z0-9]{1,20});/g;
|
||||||
let output = "",
|
let output = "",
|
||||||
m,
|
m,
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -547,6 +547,7 @@ const entityToByte = {
|
|||||||
"InvisibleComma": 8291,
|
"InvisibleComma": 8291,
|
||||||
"euro": 8364,
|
"euro": 8364,
|
||||||
"tdot": 8411,
|
"tdot": 8411,
|
||||||
|
"TripleDot": 8411,
|
||||||
"DotDot": 8412,
|
"DotDot": 8412,
|
||||||
"Copf": 8450,
|
"Copf": 8450,
|
||||||
"incare": 8453,
|
"incare": 8453,
|
||||||
@ -1026,6 +1027,7 @@ const entityToByte = {
|
|||||||
"EmptySmallSquare": 9723,
|
"EmptySmallSquare": 9723,
|
||||||
"FilledSmallSquare": 9724,
|
"FilledSmallSquare": 9724,
|
||||||
"starf": 9733,
|
"starf": 9733,
|
||||||
|
"bigstar": 9733,
|
||||||
"star": 9734,
|
"star": 9734,
|
||||||
"phone": 9742,
|
"phone": 9742,
|
||||||
"female": 9792,
|
"female": 9792,
|
||||||
|
@ -19,7 +19,7 @@ class ToHTMLEntity extends Operation {
|
|||||||
super();
|
super();
|
||||||
|
|
||||||
this.name = "To HTML Entity";
|
this.name = "To HTML Entity";
|
||||||
this.module = "Default";
|
this.module = "Encodings";
|
||||||
this.description = "Converts characters to HTML entities<br><br>e.g. <code>&</code> becomes <code>&<span>amp;</span></code>";
|
this.description = "Converts characters to HTML entities<br><br>e.g. <code>&</code> becomes <code>&<span>amp;</span></code>";
|
||||||
this.infoURL = "https://wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references";
|
this.infoURL = "https://wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references";
|
||||||
this.inputType = "string";
|
this.inputType = "string";
|
||||||
@ -33,7 +33,7 @@ class ToHTMLEntity extends Operation {
|
|||||||
{
|
{
|
||||||
"name": "Convert to",
|
"name": "Convert to",
|
||||||
"type": "option",
|
"type": "option",
|
||||||
"value": ["Named entities where possible", "Numeric entities", "Hex entities"]
|
"value": ["Named entities", "Numeric entities", "Hex entities"]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -548,7 +548,7 @@ const byteToEntity = {
|
|||||||
8290: "⁢",
|
8290: "⁢",
|
||||||
8291: "⁣",
|
8291: "⁣",
|
||||||
8364: "€",
|
8364: "€",
|
||||||
8411: "⃛ ⃛",
|
8411: "⃛",
|
||||||
8412: "⃜",
|
8412: "⃜",
|
||||||
8450: "ℂ",
|
8450: "ℂ",
|
||||||
8453: "℅",
|
8453: "℅",
|
||||||
@ -998,7 +998,7 @@ const byteToEntity = {
|
|||||||
9722: "◺",
|
9722: "◺",
|
||||||
9723: "◻",
|
9723: "◻",
|
||||||
9724: "◼",
|
9724: "◼",
|
||||||
9733: "★ ★",
|
9733: "★",
|
||||||
9734: "☆",
|
9734: "☆",
|
||||||
9742: "☎",
|
9742: "☎",
|
||||||
9792: "♀",
|
9792: "♀",
|
||||||
|
Loading…
Reference in New Issue
Block a user