writable: false,
};
+const NIL = Object.preventExtensions(Object.create(null));
+
const rawBlock = (strings, ...substitutions) => ({
tag: "raw_block",
format: "html",
);
if (internalLinks.size) {
links_section.push(
- rawBlock`<details>`,
+ rawBlock`<details open="">`,
rawBlock`<summary>on this wiki</summary>`,
listOfInternalLinks(internalLinks),
rawBlock`</details>`,
}
if (externalLinks.size) {
links_section.push(
- rawBlock`<details>`,
+ rawBlock`<details open="">`,
rawBlock`<summary>elsewhere on the Web</summary>`,
{
tag: "bullet_list",
e.children.push(...links_section);
},
},
+ emph: {
+ enter: (_) => {},
+ exit: (e) => {
+ const attributes = e.attributes ?? NIL;
+ const { as } = attributes;
+ if (as) {
+ delete attributes.as;
+ if (
+ as == "b" || as == "cite" || as == "i" || as == "u"
+ ) {
+ return [
+ rawInline`<${as}>`,
+ ...e.children,
+ rawInline`</${as}>`,
+ ];
+ } else {
+ /* do nothing */
+ }
+ } else {
+ /* do nothing */
+ }
+ },
+ },
hard_break: {
enter: (_) => {
if (titleSoFar != null) {
},
exit: (_) => {},
},
+ symb: {
+ enter: (e) => {
+ const { alias } = e;
+ const codepoint = /^U\+([0-9A-Fa-f]+)$/u.exec(alias)?.[1];
+ if (codepoint) {
+ return str`${
+ 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;
+ }
+ },
+ },
};
});
Object.defineProperties(this, {
refs,
} = result;
yield* listOfInternalLinks(refs, (link) => ({
- tag: index ? "strong" : "span",
+ tag: index == 0 ? "span" : "strong",
attributes: { "data-recency": `${index}` },
children: [
link,
- str` `,
- rawInline`<small>(<time dateTime="${dateTime}">`,
- str`${humanReadable}`,
- rawInline`</time>)</small>`,
+ ...(index == 0 ? [] : [
+ str` `,
+ rawInline`<small>(<time dateTime="${dateTime}">`,
+ str`${humanReadable}`,
+ rawInline`</time>)</small>`,
+ ]),
],
})).children;
} else {
},
heading: {
enter: (e) => {
- const attributes = e.attributes ?? Object.create(null);
+ const attributes = e.attributes ?? NIL;
if (
isNavigationPage && e.level == 1 &&
attributes?.class == "main"
}
if (children.length == 0) {
const section =
- pages.get(reference)?.sections?.main ??
- Object.create(null);
+ pages.get(reference)?.sections?.main ?? NIL;
const { v } = attributes;
if (v == null) {
children.push(