import {
emptyDir,
ensureDir,
-} from "https://deno.land/std@0.195.0/fs/mod.ts";
+} from "https://deno.land/std@0.196.0/fs/mod.ts";
+import {
+ JSON_SCHEMA,
+ parse as parseYaml,
+} from "https://deno.land/std@0.196.0/yaml/mod.ts";
import djot from "npm:@djot/djot@0.2.3";
import { Parser } from "npm:htmlparser2@9.0.0";
import { DomHandler, Element, Text } from "npm:domhandler@5.0.3";
),
});
-const diffReferences = async (hash) => {
+const diffReferences = async (hash, againstHead = false) => {
const diff = new Deno.Command("git", {
args: [
"diff-tree",
"--name-only",
"--no-renames",
"--diff-filter=AM",
- hash,
+ ...(againstHead ? [hash, "HEAD"] : [hash]),
],
stdout: "piped",
stderr: "piped",
#internalLinks = new Set();
#externalLinks = new Map();
- constructor(namespace, name, ast, source) {
+ constructor(namespace, name, ast, source, config) {
const internalLinks = this.#internalLinks;
const externalLinks = this.#externalLinks;
const sections = Object.create(null);
String.fromCodePoint(parseInt(codepoint, 16))
}`;
} else {
- return {
- "--8": str`${"—\u2060:\u202F"}`, // reverse puppyprick
- "8--": str`${"\u202F:\u2060—"}`, // forward puppyprick
- sp: rawInline` `, // space
- nbsp: str`${"\xA0"}`, // no‐break space
- cgj: str`${"\u034F"}`, // combining grapheme joiner
- ensp: str`${"\u2002"}`, // enspace
- emsp: str`${"\u2003"}`, // emspace
- figsp: str`${"\u2007"}`, // figure space
- zwsp: str`${"\u200B"}`, // zero‐width space
- zwnj: str`${"\u200C"}`, // zero‐width nonjoiner
- zwj: str`${"\u200D"}`, // zero‐width joiner
- nnbsp: str`${"\u202F"}`, // narrow no‐break space
- mathsp: str`${"\u205F"}`, // math space
- wj: str`${"\u2060"}`, // word joiner
- fwsp: str`${"\u3000"}`, // fullwidth space
- }[alias] ?? e;
+ const resolved = config.symbols?.[alias];
+ return resolved != null ? str`${resolved}` : e;
}
},
},
}
{
+ const config = await getRemoteContent("config.yaml").then((yaml) =>
+ parseYaml(yaml, { schema: JSON_SCHEMA })
+ );
const ls = new Deno.Command("git", {
args: ["ls-tree", "-rz", "live"],
stdout: "piped",
console.warn(`Djot(${reference}): ${$.render()}`),
}),
source,
+ config,
);
const reference = `${namespace}:${pageName}`;
pages.set(reference, page);
console.warn(`Djot(${reference}): ${$.render()}`),
}),
source,
+ config,
);
pages.set(reference, page);
}
]).then(logErrorsAndCollectResults);
const refs = [];
current = hash;
- for (const ref of (await diffReferences(current))) {
+ for (
+ const ref of (await diffReferences(current, !recency))
+ ) {
if (seen.has(ref)) {
/* do nothing */
} else {
seen.add(ref);
}
}
- results[recency] = { dateTime, humanReadable, refs };
+ results[recency] = { dateTime, hash, humanReadable, refs };
} while (recency-- > 0 && current && current != commit);
return results;
})(),