« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/page/static.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/page/static.js')
-rw-r--r--src/page/static.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/page/static.js b/src/page/static.js
new file mode 100644
index 0000000..ff57c4f
--- /dev/null
+++ b/src/page/static.js
@@ -0,0 +1,40 @@
+// Static content page specification. (These are static pages coded into the
+// wiki data folder, used for a variety of purposes, e.g. wiki info,
+// changelog, and so on.)
+
+// Imports
+
+import fixWS from 'fix-whitespace';
+
+// Page exports
+
+export function targets({wikiData}) {
+    return wikiData.staticPageData;
+}
+
+export function write(staticPage, {wikiData}) {
+    const page = {
+        type: 'page',
+        path: ['staticPage', staticPage.directory],
+        page: ({
+            strings,
+            transformMultiline
+        }) => ({
+            title: staticPage.name,
+            stylesheet: staticPage.stylesheet,
+
+            main: {
+                content: fixWS`
+                    <div class="long-content">
+                        <h1>${staticPage.name}</h1>
+                        ${transformMultiline(staticPage.content)}
+                    </div>
+                `
+            },
+
+            nav: {simple: true}
+        })
+    };
+
+    return [page];
+}