mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 23:36:16 -04:00
Merge branch 'gsilvapt-master'
This commit is contained in:
commit
ace71f20b3
2 changed files with 30 additions and 2 deletions
|
@ -47,6 +47,11 @@ class Diff extends Operation {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Show subtraction",
|
||||||
|
"type": "boolean",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Ignore whitespace",
|
"name": "Ignore whitespace",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
@ -67,6 +72,7 @@ class Diff extends Operation {
|
||||||
diffBy,
|
diffBy,
|
||||||
showAdded,
|
showAdded,
|
||||||
showRemoved,
|
showRemoved,
|
||||||
|
showSubtraction,
|
||||||
ignoreWhitespace
|
ignoreWhitespace
|
||||||
] = args,
|
] = args,
|
||||||
samples = input.split(sampleDelim);
|
samples = input.split(sampleDelim);
|
||||||
|
@ -116,7 +122,7 @@ class Diff extends Operation {
|
||||||
if (showAdded) output += "<span class='hl5'>" + Utils.escapeHtml(diff[i].value) + "</span>";
|
if (showAdded) output += "<span class='hl5'>" + Utils.escapeHtml(diff[i].value) + "</span>";
|
||||||
} else if (diff[i].removed) {
|
} else if (diff[i].removed) {
|
||||||
if (showRemoved) output += "<span class='hl3'>" + Utils.escapeHtml(diff[i].value) + "</span>";
|
if (showRemoved) output += "<span class='hl3'>" + Utils.escapeHtml(diff[i].value) + "</span>";
|
||||||
} else {
|
} else if (!showSubtraction) {
|
||||||
output += Utils.escapeHtml(diff[i].value);
|
output += Utils.escapeHtml(diff[i].value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,29 @@ TestRegister.addTests([
|
||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
"op": "Diff",
|
"op": "Diff",
|
||||||
"args": ["\\n\\n", "Character", true, true, false]
|
"args": ["\\n\\n", "Character", true, true, false, false]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Diff added with subtraction, basic usage",
|
||||||
|
input: "testing23\n\ntesting123",
|
||||||
|
expectedOutput: "<span class='hl5'>1</span>",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
"op": "Diff",
|
||||||
|
"args": ["\\n\\n", "Character", true, true, true, false]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Diff removed with subtraction, basic usage",
|
||||||
|
input: "testing123\n\ntesting3",
|
||||||
|
expectedOutput: "<span class='hl3'>12</span>",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
"op": "Diff",
|
||||||
|
"args": ["\\n\\n", "Character", true, true, true, false]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue