Move around files so the repo will be organized as a monorepo.
This commit is contained in:
parent
65d1880a84
commit
08c69f0fd3
365 changed files with 1477 additions and 1262 deletions
|
@ -1,55 +0,0 @@
|
|||
import { parseVariantsData } from "../../export-data/variants-data.mjs";
|
||||
import { ImgX, MdCol } from "../md-format-tools.mjs";
|
||||
|
||||
export default async function processCvOt(dirs) {
|
||||
const variantsData = await parseVariantsData();
|
||||
const md = new MdCol("Section-OT-Character-Variants");
|
||||
const TableColumns = 12;
|
||||
md.log(`<table>`);
|
||||
for (const cv of variantsData.primes) {
|
||||
if (!cv.tag) continue;
|
||||
let effVariants = [];
|
||||
for (const cvv of cv.variants) if (cvv.rank) effVariants.push(cvv);
|
||||
const entryWidth = sampleImageCountEmOfCv(cv);
|
||||
const imgWidth = 32 * entryWidth;
|
||||
const entriesPerRow = Math.floor(TableColumns / entryWidth);
|
||||
const rowsNeeded = Math.ceil(effVariants.length / entriesPerRow);
|
||||
const itemColSpanHtml = entryWidth > 1 ? ` colspan="${entryWidth}"` : ``;
|
||||
for (let rid = 0; rid < rowsNeeded; rid++) {
|
||||
const entriesInThisRow = Math.min(
|
||||
entriesPerRow,
|
||||
effVariants.length - rid * entriesPerRow
|
||||
);
|
||||
const tailBlankColumnsCount = TableColumns - entryWidth * entriesInThisRow;
|
||||
// Image row
|
||||
md.log(`<tr>`);
|
||||
if (rid === 0) md.log(`<td rowspan="${2 * rowsNeeded}"><code>${cv.tag}</code></td>`);
|
||||
for (let cid = 0; cid < entriesPerRow; cid++) {
|
||||
const iCvv = rid * entriesPerRow + cid;
|
||||
if (iCvv >= effVariants.length) continue;
|
||||
const cvv = effVariants[iCvv];
|
||||
const imageID = `${dirs.images}/cv-${cv.key}-${cvv.key}`;
|
||||
const image = ImgX(imageID, imgWidth);
|
||||
md.log(`<td${itemColSpanHtml}>${image}</td>`);
|
||||
}
|
||||
if (tailBlankColumnsCount > 0) md.log(`<td colspan="${tailBlankColumnsCount}"> </td>`);
|
||||
md.log(`</tr>`);
|
||||
// CV ID row
|
||||
md.log(`<tr>`);
|
||||
for (let cid = 0; cid < entriesPerRow; cid++) {
|
||||
const iCvv = rid * entriesPerRow + cid;
|
||||
if (iCvv >= effVariants.length) continue;
|
||||
const cvv = effVariants[iCvv];
|
||||
md.log(`<td${itemColSpanHtml}>${cvv.rank}</td>`);
|
||||
}
|
||||
if (tailBlankColumnsCount > 0) md.log(`<td colspan="${tailBlankColumnsCount}"> </td>`);
|
||||
md.log(`</tr>`);
|
||||
}
|
||||
}
|
||||
md.log(`</table>`);
|
||||
return md;
|
||||
}
|
||||
|
||||
export function sampleImageCountEmOfCv(cv) {
|
||||
return cv.hotChars.length * (cv.slopeDependent ? 2 : 1);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue