commit 886801f58d90cc1e3309d72fc392646895c2a5a3
parent e5b03b4b571242187949e95762b667dac1ef4c47
Author: William Casarin <jb55@jb55.com>
Date: Wed, 27 Oct 2021 17:54:44 -0700
support forks
Diffstat:
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/index.js b/index.js
@@ -40,11 +40,30 @@ function process_item(root, lines, item)
}
}
+function get_fork(journal)
+{
+ let fork = null
+ for (const item of journal)
+ {
+ if (item.type === "fork") {
+ if (item.site)
+ fork = "/" + item.site
+ else
+ fork = null
+ }
+ }
+
+ return fork
+}
+
function fedwiki2gmi(root, article)
{
let lines = []
lines.push(`# ${article.title}`)
+ const fork = get_fork(article.journal)
+ root = fork || root
+
for (const item of article.story) {
process_item(root, lines, item)
}