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

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("<***>")
"(*",
"*)",
"[|",
"|]",
"{|",
"|}",
"++",
"+++",
"\\/",
"/\\",
"|-",
"-|",
"<!--",
"<!---",
"<***>"
]
];