Improve the mechamism when generating ligation previews

This commit is contained in:
be5invis 2021-07-25 00:39:46 -07:00
parent 7d8a9582a8
commit b2a27c7b9f
22 changed files with 229 additions and 215 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

View file

@ -1,153 +1,204 @@
[simple.center-ops]
ligGroup = 'center-ops'
samples = [":=", ":-", ":+", "<*", "<*>", "*>", "+:", "-:", "=:", "<***>", ":>"]
desc = 'Vertically align some of the operators (like `*`) to the center position it is before or after a "center" operator (like `+`)'
[simple.arrow]
ligGroup = "arrow"
samples = ["<--", "<---", "<<-", "<-", "->", "->>", "-->", "--->", "<->", "<-->", "<--->", "<---->", "<==", "<===", "<<=", "=>", "=>>", "==>", "===>", "<=>", "<==>", "<===>", "<====>", "<~~", "<~", "~>", "~~>", "-------->"]
desc = 'Enable ligation set that forms arrows'
[simple.arrow2]
ligGroup = "arrow2"
samples = ["-<<", "-<", "-<-", "->-", ">-", ">>-", "=<<", "=<", "=<=", "=>=", "<=<", ">=>", "-<<", "-<", "-<-", "->-", ">-", ">>-", "=<<", ">>=", "=<", "=<=", "=>="]
desc = 'Enable ligation for more arrows, like `>>=`'
[simple.trig]
ligGroup = "trig"
samples = ["<|", "<|>", "|>"]
desc = 'Enable ligation for `<|`, `|>` , `<||`, and other bar-and-angle-bracket symbols'
[simple.eqeqeq]
ligGroup = "eqeqeq"
samples = ["==="]
sampleRank = 2
desc = 'Enable special ligation for `===` with triple lines'
[simple.eqeq]
ligGroup = "eqeq"
samples = ["==", "==="]
desc = 'Enable ligation for `==` and `===`'
[simple.ineq]
ligGroup = "ineq"
samples = ["<=", ">="]
desc = 'Enable ligation for `<=` and `>=`'
[simple.exeqeq]
ligGroup = "exeqeq"
samples = ["!=="]
sampleRank = 3
desc = 'Enable special ligation for `!==` with triple lines'
[simple.exeqeq-dotted]
ligGroup = "exeqeq-dotted"
samples = ["!=="]
sampleRank = 4
desc = 'Enable special ligation for `!==` with triple lines, and a dot at below for distinction'
[simple.eqexeq]
ligGroup = "eqexeq"
samples = ["=!="]
desc = 'Enable special ligation for `=!=` with triple lines'
[simple.eqexeq-dotted]
ligGroup = "eqexeq-dotted"
samples = ["=!="]
sampleRank = 2
desc = 'Enable special ligation for `=!=` with triple lines and a dot at below for distinction'
[simple.eqexeq-dl]
ligGroup = "eqexeq-dl"
samples = ["=!="]
desc = 'Enable special ligation for `=!=` with double lines'
[simple.eqexeq-dl-dotted]
ligGroup = "eqexeq-dl-dotted"
samples = ["=!="]
sampleRank = 2
desc = 'Enable special ligation for `=!=` with double lines, and a dot at below for distinction'
[simple.exeq]
ligGroup = "exeq"
samples = ["!=", "!=="]
desc = 'Enable ligation for `!=` and `!==`'
[simple.exeq-dotted]
ligGroup = "exeq-dotted"
samples = ["!=", "!=="]
rank = 2
desc = 'Enable ligation for `!=` and `!==` with a dot at below for distinction'
[simple.tildeeq]
ligGroup = "tildeeq"
samples = ["~="]
desc = 'Enable ligation for `~=` as inequality'
[simple.eqslasheq]
ligGroup = "eqslasheq"
samples = ["=/="]
sampleRank = 2
desc = 'Enable special triple-line ligation for `=/=` as inequality'
[simple.slasheq]
ligGroup = "slasheq"
samples = ["/=", "=/="]
desc = 'Enable ligation for `/=` and `=/=` as inequality'
[simple.ltgt-ne]
ligGroup = "ltgt-ne"
samples = ["<>"]
sampleRank = 2
desc = 'Enable ligation for `<>` as inequality'
[simple.ltgt-diamond]
ligGroup = "ltgt-diamond"
samples = ["<>"]
desc = 'Enable ligation for `<>` as diamond'
[simple.brst]
ligGroup = "brst"
samples = ["(*", "*)", "(* comm *)"]
desc = 'Center asterisk in `(*` and `*)`'
[simple.plusplus]
ligGroup = "plusplus"
samples = ["++", "+++"]
desc = 'Enable ligation for `++` and further plus-chaining'
[simple.kern-dotty]
ligGroup = "kern-dotty"
samples = ["::", ":::"]
desc = 'Move connecting dotty punctuations closer, like for `::`, `:::` and `...`'
[simple.logic]
ligGroup = "logic"
samples = ["/\\", "\\/", "|-", "-|"]
desc = 'Enable ligation for `/\` and `\/`'
[simple.llgg]
ligGroup = "llgg"
samples = ["<<", ">>", "<<<", ">>>"]
desc = 'Enable ligation for `<<`, `>>` and other angle-bracket chaining'
[simple.llggeq]
ligGroup = "llggeq"
samples = ["<<=", ">>="]
sampleRank = 2
desc = 'Enable ligation for `<<=`, `>>=` as shift operator'
[simple.dot-as-operator]
ligGroup = "dot-oper"
samples = ["<.", "<.>", ".>"]
desc = 'Treat dot (`.`) as operator and perform chained centering'
[simple.lteq-as-arrow]
ligGroup = "arrowZALE"
samples = ["<="]
sampleRank = 2
desc = 'Treat `<=` as arrow'
[simple.gteq-as-co-arrow]
ligGroup = "arrowZAGE"
samples = [">="]
sampleRank = 2
desc = 'Treat `>=` as co-arrow'
[simple.html-comment]
ligGroup = "html-comment"
samples = ["<!--", "<!---"]
desc = 'Enable ligation for `<!--` and `<!---`'
[simple.colon-greater-as-colon-arrow]
ligGroup = "colon-greater"
samples = [":>"]
sampleRank = 2
desc = 'Transform `:>` into `:` and a narrow arrow'
[simple.brace-bar]
ligGroup = 'brace-bar'
samples = ["{|", "|}"]
desc = 'Enable ligation for `{|` and `|}`'
[simple.brack-bar]
ligGroup = 'brack-bar'
samples = ["[|", "|]"]
desc = 'Enable ligation for `[|` and `|]`'
[simple.connected-underscore]
ligGroup = 'connected-underscore'
samples = ["__", "___"]
desc = 'Make contiguous underscores (like `__`) connected'
[simple.connected-number-sign]
ligGroup = 'connected-number-sign'
samples = ["##", "###"]
desc = 'Make contiguous number signs (like `##`) connected'
[simple.connected-tilde-as-wave]
ligGroup = 'connected-tilde-as-wave'
samples = ["~~", "~~~"]
desc = 'Make contiguous ASCII tildes (like `~~`) connected as a wave line'
[simple.connected-hyphen-as-solid-line]
ligGroup = 'connected-hyphen-as-solid-line'
samples = ["--", "---"]
desc = 'Make contiguous hyphen-minuses (like `--`) connected as a straight solid line'
[simple.connected-hyphen-as-semi-dashed-line]
ligGroup = 'connected-hyphen-as-semi-dashed-line'
samples = ["--", "---"]
sampleRank = 2
desc = 'Make contiguous hyphen-minuses (like `--`) connected as a straight semi-dashed line, identifying each hyphen component'
###################################################################################################

View file

@ -73,22 +73,22 @@ function cbAmendLigsetSamplerContents(element, p) {
element.appendChild(line);
for (let m = 0; m < row.length; m++) {
if (m > 0) line.appendChild(document.createTextNode(" "));
const item = row[m];
const sampleStr = row[m];
let rank = 0;
for (let k = item.tags.length; k-- > 0; ) {
if (groupSet.has(item.tags[k])) {
rank = k + 1;
break;
}
for (const [lgName, lg] of Object.entries(auxData.ligationCherry)) {
if (!groupSet.has(lg.ligGroup)) continue;
if (!new Set(lg.samples || []).has(sampleStr)) continue;
const rankT = lg.sampleRank || 1;
if (rankT > rank) rank = rankT;
}
if (rank) {
const run = document.createElement("em");
run.appendChild(document.createTextNode(item.s));
run.appendChild(document.createTextNode(sampleStr));
run.className = `rank-${rank}`;
line.appendChild(run);
} else {
const run = document.createElement("s");
run.appendChild(document.createTextNode(item.s));
run.appendChild(document.createTextNode(sampleStr));
run.className = `rank-${rank}`;
line.appendChild(run);
}

View file

@ -202,7 +202,7 @@ section.cv-sampler
font-style: normal;
color: #444;
&.rank-2
&.rank-2, &.rank-3, &.rank-4
color: #c33500;
s

View file

@ -4,229 +4,187 @@ const fs = require("fs-extra");
const path = require("path");
const toml = require("@iarna/toml");
function TAG(...ltag) {
return function (s) {
return { tags: ltag, s: s };
};
}
const arrow = TAG("arrow");
const arrow2 = TAG("arrow2");
const centerOps = TAG("center-ops");
const eqeq = TAG("eqeq");
const exeq = TAG("exeq");
const eqeqeq = TAG("eqeq", "eqeqeq");
const exeqeq = TAG("exeq", "exeqeq");
const eqexeq = TAG("eqexeq", "eqexeq", "eqexeq-dl");
const eqslasheq = TAG("slasheq", "eqslasheq");
const slasheq = TAG("slasheq");
const tildeeq = TAG("tildeeq");
const ineq = TAG("ineq");
const logc = TAG("logic");
const brst = TAG("brst");
const trig = TAG("trig");
const ltgt = TAG("ltgt-diamond", "ltgt-ne");
const llggeq_a = TAG("arrow", "llggeq");
const llggeq_b = TAG("arrow2", "llggeq");
const dotOper = TAG("dot-oper");
const kernDotty = TAG("kern-dotty");
const htmlComment = TAG("html-comment");
const plusPlus = TAG("plusplus");
const colonGt = TAG("colon-greater");
const brackBar = TAG("brack-bar");
const braceBar = TAG("brace-bar");
const underscores = TAG("connected-underscore");
const ligationSamples = [
[
arrow2("-<<"),
arrow2("-<"),
arrow2("-<-"),
arrow("<--"),
arrow("<---"),
arrow("<<-"),
arrow("<-"),
arrow("->"),
arrow("->>"),
arrow("-->"),
arrow("--->"),
arrow2("->-"),
arrow2(">-"),
arrow2(">>-"),
arrow("<->"),
arrow("<-->"),
arrow("<--->"),
arrow("<---->"),
htmlComment("<!--")
"-<<",
"-<",
"-<-",
"<--",
"<---",
"<<-",
"<-",
"->",
"->>",
"-->",
"--->",
"->-",
">-",
">>-",
"<->",
"<-->",
"<--->",
"<---->",
"<!--"
],
[
arrow2("=<<"),
arrow2("=<"),
arrow2("=<="),
arrow("<=="),
arrow("<==="),
llggeq_a("<<="),
ineq("<="),
arrow("=>"),
arrow("=>>"),
arrow("==>"),
arrow("===>"),
arrow2("=>="),
ineq(">="),
llggeq_b(">>="),
arrow("<=>"),
arrow("<==>"),
arrow("<===>"),
arrow("<====>"),
htmlComment("<!---")
"=<<",
"=<",
"=<=",
"<==",
"<===",
"<<=",
"<=",
"=>",
"=>>",
"==>",
"===>",
"=>=",
">=",
">>=",
"<=>",
"<==>",
"<===>",
"<====>",
"<!---"
],
[
brackBar("[|"),
brackBar("|]"),
braceBar("{|"),
braceBar("|}"),
arrow2("<=<"),
arrow2(">=>"),
arrow("<~~"),
arrow("<~"),
arrow("~>"),
arrow("~~>"),
kernDotty("::"),
kernDotty(":::"),
logc("\\/"),
logc("/\\"),
eqeq("=="),
exeq("!="),
slasheq("/="),
tildeeq(`~=`),
ltgt(`<>`),
eqeqeq("==="),
exeqeq("!=="),
eqslasheq("=/="),
eqexeq("=!="),
colonGt(":>")
"[|",
"|]",
"{|",
"|}",
"<=<",
">=>",
"<~~",
"<~",
"~>",
"~~>",
"::",
":::",
"\\/",
"/\\",
"==",
"!=",
"/=",
`~=`,
`<>`,
"===",
"!==",
"=/=",
"=!=",
":>"
],
[
centerOps(":="),
centerOps(":-"),
centerOps(":+"),
centerOps("<*"),
centerOps("<*>"),
centerOps("*>"),
trig("<|"),
trig("<|>"),
trig("|>"),
dotOper("<."),
dotOper("<.>"),
dotOper(".>"),
centerOps("+:"),
centerOps("-:"),
centerOps("=:"),
centerOps("<***>"),
underscores("__"),
brst("(* comm *)"),
plusPlus("++"),
plusPlus("+++"),
logc("|-"),
logc("-|")
":=",
":-",
":+",
"<*",
"<*>",
"*>",
"<|",
"<|>",
"|>",
"<.",
"<.>",
".>",
"+:",
"-:",
"=:",
"<***>",
"__",
"(* comm *)",
"++",
"+++",
"|-",
"-|"
]
];
const ligationSamplesNarrow = [
[
arrow2("-<<"),
arrow2("-<"),
arrow2("-<-"),
arrow("<--"),
arrow("<---"),
arrow("<<-"),
arrow("<-"),
arrow("->"),
arrow("->>"),
arrow("-->"),
arrow("--->"),
arrow2("->-"),
arrow2(">-"),
arrow2(">>-")
"-<<",
"-<",
"-<-",
"<--",
"<---",
"<<-",
"<-",
"->",
"->>",
"-->",
"--->",
"->-",
">-",
">>-"
],
[
arrow2("=<<"),
arrow2("=<"),
arrow2("=<="),
arrow("<=="),
arrow("<==="),
llggeq_a("<<="),
ineq("<="),
arrow("=>"),
arrow("=>>"),
arrow("==>"),
arrow("===>"),
arrow2("=>="),
ineq(">="),
llggeq_b(">>=")
"=<<",
"=<",
"=<=",
"<==",
"<===",
"<<=",
"<=",
"=>",
"=>>",
"==>",
"===>",
"=>=",
">=",
">>="
],
["<->", "<-->", "<--->", "<---->", "<=>", "<==>", "<===>", "<====>", "-------->"],
[
"<~~",
"<~",
"~>",
"~~>",
"::",
":::",
"==",
"!=",
"/=",
`~=`,
`<>`,
"===",
"!==",
"=/=",
"=!="
],
[
arrow("<->"),
arrow("<-->"),
arrow("<--->"),
arrow("<---->"),
arrow("<=>"),
arrow("<==>"),
arrow("<===>"),
arrow("<====>"),
arrow("-------->")
":=",
":-",
":+",
"<*",
"<*>",
"*>",
"<|",
"<|>",
"|>",
"<.",
"<.>",
".>",
"+:",
"-:",
"=:",
":>",
"__"
],
[
arrow("<~~"),
arrow("<~"),
arrow("~>"),
arrow("~~>"),
kernDotty("::"),
kernDotty(":::"),
eqeq("=="),
exeq("!="),
slasheq("/="),
tildeeq(`~=`),
ltgt(`<>`),
eqeqeq("==="),
exeqeq("!=="),
eqslasheq("=/="),
eqexeq("=!=")
],
[
centerOps(":="),
centerOps(":-"),
centerOps(":+"),
centerOps("<*"),
centerOps("<*>"),
centerOps("*>"),
trig("<|"),
trig("<|>"),
trig("|>"),
dotOper("<."),
dotOper("<.>"),
dotOper(".>"),
centerOps("+:"),
centerOps("-:"),
centerOps("=:"),
colonGt(":>"),
underscores("__")
],
[
brst("(*"),
brst("*)"),
brackBar("[|"),
brackBar("|]"),
braceBar("{|"),
braceBar("|}"),
plusPlus("++"),
plusPlus("+++"),
logc("\\/"),
logc("/\\"),
logc("|-"),
logc("-|"),
htmlComment("<!--"),
htmlComment("<!---"),
centerOps("<***>")
"(*",
"*)",
"[|",
"|]",
"{|",
"|}",
"++",
"+++",
"\\/",
"/\\",
"|-",
"-|",
"<!--",
"<!---",
"<***>"
]
];

View file

@ -6,7 +6,6 @@ const path = require("path");
const parseVariantsData = require("../export-data/variants-data");
const getLigationData = require("../export-data/ligation-data");
const execMain = require("../shared/execMain");
const variantsData = require("../export-data/variants-data");
const inputPath = process.argv[2];
const outputPath = process.argv[3];
@ -51,6 +50,7 @@ async function main() {
applyCallbackArgs: ls
});
}
/*
for (const ss of variationData.composites) {
readmeSnapshotTasks.push({
el: "#packaging-sampler",
@ -107,9 +107,14 @@ async function main() {
});
}
}
*/
await fs.writeJson(
outputDataPath,
{ readmeSnapshotTasks, ligationSamples: ligationData.samples },
{
readmeSnapshotTasks,
ligationSamples: ligationData.samples,
ligationCherry: ligationData.cherry
},
{ spaces: " " }
);
}