« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateStaticPage.js11
-rw-r--r--src/data/things/static-page.js1
-rw-r--r--src/data/yaml.js1
3 files changed, 11 insertions, 2 deletions
diff --git a/src/content/dependencies/generateStaticPage.js b/src/content/dependencies/generateStaticPage.js
index 3e27fd43..226152c7 100644
--- a/src/content/dependencies/generateStaticPage.js
+++ b/src/content/dependencies/generateStaticPage.js
@@ -1,5 +1,6 @@
 export default {
   contentDependencies: ['generatePageLayout', 'transformContent'],
+  extraDependencies: ['html'],
 
   relations(relation, staticPage) {
     return {
@@ -12,10 +13,11 @@ export default {
     return {
       name: staticPage.name,
       stylesheet: staticPage.stylesheet,
+      script: staticPage.script,
     };
   },
 
-  generate(data, relations) {
+  generate(data, relations, {html}) {
     return relations.layout
       .slots({
         title: data.name,
@@ -27,7 +29,12 @@ export default {
             : []),
 
         mainClasses: ['long-content'],
-        mainContent: relations.content,
+        mainContent: [
+          relations.content,
+
+          data.script &&
+            html.tag('script', data.script),
+        ],
 
         navLinkStyle: 'hierarchical',
         navLinks: [
diff --git a/src/data/things/static-page.js b/src/data/things/static-page.js
index ab9c5f98..8a3fd10e 100644
--- a/src/data/things/static-page.js
+++ b/src/data/things/static-page.js
@@ -30,5 +30,6 @@ export class StaticPage extends Thing {
     directory: directory(),
     content: simpleString(),
     stylesheet: simpleString(),
+    script: simpleString(),
   });
 }
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 2c600341..dda06949 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -646,6 +646,7 @@ export const processStaticPageDocument = makeProcessDocument(T.StaticPage, {
     directory: 'Directory',
 
     stylesheet: 'Style',
+    script: 'Script',
     content: 'Content',
   },
 });