Port over column filter to static cube generator
This commit is contained in:
parent
f5c94268be
commit
9953f6c289
1 changed files with 11 additions and 0 deletions
11
cmd/cube.ts
11
cmd/cube.ts
|
@ -32,6 +32,16 @@ const colorNames = {
|
||||||
URG: "Temur"
|
URG: "Temur"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const columns: Record<string, (c: CardItem) => boolean> = {
|
||||||
|
W: c => colorid(c.colorIdentity) == "W",
|
||||||
|
U: c => colorid(c.colorIdentity) == "U",
|
||||||
|
B: c => colorid(c.colorIdentity) == "B",
|
||||||
|
R: c => colorid(c.colorIdentity) == "R",
|
||||||
|
G: c => colorid(c.colorIdentity) == "G",
|
||||||
|
MC: c => c.colorIdentity.length > 0,
|
||||||
|
CL: c => colorid(c.colorIdentity) == "CL"
|
||||||
|
};
|
||||||
|
|
||||||
function wubrg(a: string, b: string) {
|
function wubrg(a: string, b: string) {
|
||||||
const order = ["W", "U", "B", "R", "G"];
|
const order = ["W", "U", "B", "R", "G"];
|
||||||
const indexA = order.indexOf(a);
|
const indexA = order.indexOf(a);
|
||||||
|
@ -87,6 +97,7 @@ async function run() {
|
||||||
const template = await ejs.renderFile("templates/cube.ejs", {
|
const template = await ejs.renderFile("templates/cube.ejs", {
|
||||||
user: uid,
|
user: uid,
|
||||||
cards: valid,
|
cards: valid,
|
||||||
|
columns,
|
||||||
utils: { wubrg, colorNames, colorid }
|
utils: { wubrg, colorNames, colorid }
|
||||||
});
|
});
|
||||||
let cubeFile = `${uid}-cube.html`;
|
let cubeFile = `${uid}-cube.html`;
|
||||||
|
|
Loading…
Reference in a new issue