summaryrefslogtreecommitdiffhomepage
path: root/vhosts/blog/nuldoc-src/djot/djot2ndoc.ts
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-05-06 15:25:27 +0900
committernsfisis <nsfisis@gmail.com>2025-05-06 15:25:27 +0900
commit83c58924bfd9f22ef4ff84fd3439535e4753ec53 (patch)
tree90034e4106965433eb587610edfe4356853b96a2 /vhosts/blog/nuldoc-src/djot/djot2ndoc.ts
parentce9308b47d5eba482862ae24968c198bbf466e21 (diff)
downloadnsfisis.dev-83c58924bfd9f22ef4ff84fd3439535e4753ec53.tar.gz
nsfisis.dev-83c58924bfd9f22ef4ff84fd3439535e4753ec53.tar.zst
nsfisis.dev-83c58924bfd9f22ef4ff84fd3439535e4753ec53.zip
feat(blog/nuldoc): implement footnote
Diffstat (limited to 'vhosts/blog/nuldoc-src/djot/djot2ndoc.ts')
-rw-r--r--vhosts/blog/nuldoc-src/djot/djot2ndoc.ts54
1 files changed, 23 insertions, 31 deletions
diff --git a/vhosts/blog/nuldoc-src/djot/djot2ndoc.ts b/vhosts/blog/nuldoc-src/djot/djot2ndoc.ts
index d1559f2f..07071441 100644
--- a/vhosts/blog/nuldoc-src/djot/djot2ndoc.ts
+++ b/vhosts/blog/nuldoc-src/djot/djot2ndoc.ts
@@ -529,20 +529,13 @@ function processEmail(node: DjotEmail): Element {
};
}
-function processFootnoteReference(node: DjotFootnoteReference): Node {
- void node;
- // TODO
+function processFootnoteReference(node: DjotFootnoteReference): Element {
return {
- kind: "text",
- content: "",
- raw: false,
+ kind: "element",
+ name: "footnoteref",
+ attributes: new Map([["reference", node.text]]),
+ children: [],
};
- // return {
- // kind: "element",
- // name: "footnoteref",
- // attributes: new Map([["reference", node.text]]),
- // children: [],
- // };
}
function processUrl(node: DjotUrl): Element {
@@ -799,25 +792,24 @@ export function djot2ndoc(doc: DjotDoc): Element {
// Process footnotes if any exist
if (doc.footnotes && Object.keys(doc.footnotes).length > 0) {
- // TODO
- // const footnoteSection: Element = {
- // kind: "element",
- // name: "section",
- // attributes: new Map([["class", "footnotes"]]),
- // children: [],
- // };
- //
- // for (const [id, footnote] of Object.entries(doc.footnotes)) {
- // const footnoteElement: Element = {
- // kind: "element",
- // name: "footnote",
- // attributes: new Map([["id", id]]),
- // children: footnote.children.map(processBlock),
- // };
- // footnoteSection.children.push(footnoteElement);
- // }
- //
- // children.push(footnoteSection);
+ const footnoteSection: Element = {
+ kind: "element",
+ name: "section",
+ attributes: new Map([["class", "footnotes"]]),
+ children: [],
+ };
+
+ for (const [id, footnote] of Object.entries(doc.footnotes)) {
+ const footnoteElement: Element = {
+ kind: "element",
+ name: "footnote",
+ attributes: new Map([["id", id]]),
+ children: footnote.children.map(processBlock),
+ };
+ footnoteSection.children.push(footnoteElement);
+ }
+
+ children.push(footnoteSection);
}
return {