Merge pull request #1623 from jlaundry/master
change Diff to output <ins>, <del>
This commit is contained in:
commit
26fa5f3d1d
@ -119,9 +119,9 @@ class Diff extends Operation {
|
|||||||
|
|
||||||
for (let i = 0; i < diff.length; i++) {
|
for (let i = 0; i < diff.length; i++) {
|
||||||
if (diff[i].added) {
|
if (diff[i].added) {
|
||||||
if (showAdded) output += "<span class='hl5'>" + Utils.escapeHtml(diff[i].value) + "</span>";
|
if (showAdded) output += "<ins>" + Utils.escapeHtml(diff[i].value) + "</ins>";
|
||||||
} 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 += "<del>" + Utils.escapeHtml(diff[i].value) + "</del>";
|
||||||
} else if (!showSubtraction) {
|
} else if (!showSubtraction) {
|
||||||
output += Utils.escapeHtml(diff[i].value);
|
output += Utils.escapeHtml(diff[i].value);
|
||||||
}
|
}
|
||||||
|
@ -36,4 +36,5 @@
|
|||||||
@import "./layout/_structure.css";
|
@import "./layout/_structure.css";
|
||||||
|
|
||||||
/* Operations */
|
/* Operations */
|
||||||
|
@import "./operations/diff.css";
|
||||||
@import "./operations/json.css";
|
@import "./operations/json.css";
|
||||||
|
8
src/web/stylesheets/operations/diff.css
Normal file
8
src/web/stylesheets/operations/diff.css
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
del {
|
||||||
|
background-color: var(--hl3);
|
||||||
|
}
|
||||||
|
|
||||||
|
ins {
|
||||||
|
text-decoration: underline; /* shouldn't be needed, but Chromium doesn't copy to clipboard without it */
|
||||||
|
background-color: var(--hl5);
|
||||||
|
}
|
@ -108,7 +108,7 @@ module.exports = {
|
|||||||
// testOp(browser, "Derive EVP key", "test input", "test_output");
|
// testOp(browser, "Derive EVP key", "test input", "test_output");
|
||||||
// testOp(browser, "Derive PBKDF2 key", "test input", "test_output");
|
// testOp(browser, "Derive PBKDF2 key", "test input", "test_output");
|
||||||
// testOp(browser, "Detect File Type", "test input", "test_output");
|
// testOp(browser, "Detect File Type", "test input", "test_output");
|
||||||
testOpHtml(browser, "Diff", "The cat sat on the mat\n\nThe mat cat on the sat", ".hl5:first-child", "mat", ["\\n\\n", "Word", true, true, false, false]);
|
testOpHtml(browser, "Diff", "The cat sat on the mat\n\nThe mat cat on the sat", "ins:first-child", "mat", ["\\n\\n", "Word", true, true, false, false]);
|
||||||
// testOp(browser, "Disassemble x86", "test input", "test_output");
|
// testOp(browser, "Disassemble x86", "test input", "test_output");
|
||||||
testOpImage(browser, "Dither Image", "files/Hitchhikers_Guide.jpeg");
|
testOpImage(browser, "Dither Image", "files/Hitchhikers_Guide.jpeg");
|
||||||
// testOp(browser, "Divide", "test input", "test_output");
|
// testOp(browser, "Divide", "test input", "test_output");
|
||||||
|
@ -11,7 +11,7 @@ TestRegister.addTests([
|
|||||||
{
|
{
|
||||||
name: "Diff, basic usage",
|
name: "Diff, basic usage",
|
||||||
input: "testing23\n\ntesting123",
|
input: "testing23\n\ntesting123",
|
||||||
expectedOutput: "testing<span class='hl5'>1</span>23",
|
expectedOutput: "testing<ins>1</ins>23",
|
||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
"op": "Diff",
|
"op": "Diff",
|
||||||
@ -22,7 +22,7 @@ TestRegister.addTests([
|
|||||||
{
|
{
|
||||||
name: "Diff added with subtraction, basic usage",
|
name: "Diff added with subtraction, basic usage",
|
||||||
input: "testing23\n\ntesting123",
|
input: "testing23\n\ntesting123",
|
||||||
expectedOutput: "<span class='hl5'>1</span>",
|
expectedOutput: "<ins>1</ins>",
|
||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
"op": "Diff",
|
"op": "Diff",
|
||||||
@ -33,7 +33,7 @@ TestRegister.addTests([
|
|||||||
{
|
{
|
||||||
name: "Diff removed with subtraction, basic usage",
|
name: "Diff removed with subtraction, basic usage",
|
||||||
input: "testing123\n\ntesting3",
|
input: "testing123\n\ntesting3",
|
||||||
expectedOutput: "<span class='hl3'>12</span>",
|
expectedOutput: "<del>12</del>",
|
||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
"op": "Diff",
|
"op": "Diff",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user