// export GITWIKIWEB=/srv/git/GitWikiWeb
// git archive --remote=$GITWIKIWEB HEAD build.js \
// | tar -xO \
-// | deno run -A - ~/public/wiki $GITWIKIWEB
+// | deno run -A - ~/public/wiki $GITWIKIWEB current
//
// The directory `~/public/wiki` (or whatever you specify as the first
// argument to `deno run -A -`) **will be deleted** and a new static
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 DESTINATION = Deno.args[0] ?? "~/public/wiki";
const REMOTE = Deno.args[1] ?? "/srv/git/GitWikiWeb";
+const REV = Deno.args[2] ?? "HEAD";
const READ_ONLY = {
configurable: false,
const getRemoteContent = async (pathName) => {
const getArchive = new Deno.Command("git", {
- args: ["archive", `--remote=${REMOTE}`, "HEAD", pathName],
+ args: ["archive", `--remote=${REMOTE}`, REV, pathName],
stdout: "piped",
stderr: "piped",
}).spawn();
#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"],
+ args: ["ls-tree", "-rz", "HEAD"],
stdout: "piped",
stderr: "piped",
}).spawn();
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);
}