« get me outta code hell

extract static-build, new modular build modes - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/write/page-template.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-01-08 10:52:12 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-01-08 10:52:12 -0400
commitdb816222a07a4a8dff9f0f8b66e7aa7cb7c15eb5 (patch)
tree9d6c1819caf2cba7b64836d3f81dc79c2082c2a1 /src/write/page-template.js
parent782a63e25304b7f17b216a231d243f3154ae1128 (diff)
extract static-build, new modular build modes
Diffstat (limited to 'src/write/page-template.js')
-rw-r--r--src/write/page-template.js70
1 files changed, 39 insertions, 31 deletions
diff --git a/src/write/page-template.js b/src/write/page-template.js
index f7faeed0..efbc5795 100644
--- a/src/write/page-template.js
+++ b/src/write/page-template.js
@@ -10,11 +10,46 @@ import {
   img,
 } from '../misc-templates.js';
 
+export function generateDevelopersCommentHTML({
+  buildTime,
+  commit,
+  wikiData,
+}) {
+  const {name, canonicalBase} = wikiData.wikiInfo;
+  return `<!--\n` + [
+    canonicalBase
+      ? `hsmusic.wiki - ${name}, ${canonicalBase}`
+      : `hsmusic.wiki - ${name}`,
+    'Code copyright 2019-2023 Quasar Nebula et al (MIT License)',
+    ...canonicalBase === 'https://hsmusic.wiki/' ? [
+      'Data avidly compiled and localization brought to you',
+      'by our awesome team and community of wiki contributors',
+      '***',
+      'Want to contribute? Join our Discord or leave feedback!',
+      '- https://hsmusic.wiki/discord/',
+      '- https://hsmusic.wiki/feedback/',
+      '- https://github.com/hsmusic/',
+    ] : [
+      'https://github.com/hsmusic/',
+    ],
+    '***',
+    buildTime &&
+      `Site built: ${buildTime.toLocaleString('en-US', {
+        dateStyle: 'long',
+        timeStyle: 'long',
+      })}`,
+    commit &&
+      `Latest code commit: ${commit}`,
+  ]
+    .filter(Boolean)
+    .map(line => `    ` + line)
+    .join('\n') + `\n-->`;
+}
+
 export function generateDocumentHTML(pageInfo, {
-  buildTime = null,
-  cachebust = '',
-  commit = '',
+  cachebust,
   defaultLanguage,
+  developersComment,
   getThemeString,
   language,
   languages,
@@ -422,34 +457,7 @@ export function generateDocumentHTML(pageInfo, {
       'data-rebase-data': to('data.root'),
     },
     [
-      `<!--\n` + [
-        wikiInfo.canonicalBase
-          ? `hsmusic.wiki - ${wikiInfo.name}, ${wikiInfo.canonicalBase}`
-          : `hsmusic.wiki - ${wikiInfo.name}`,
-        'Code copyright 2019-2022 Quasar Nebula et al (MIT License)',
-        ...wikiInfo.canonicalBase === 'https://hsmusic.wiki/' ? [
-          'Data avidly compiled and localization brought to you',
-          'by our awesome team and community of wiki contributors',
-          '***',
-          'Want to contribute? Join our Discord or leave feedback!',
-          '- https://hsmusic.wiki/discord/',
-          '- https://hsmusic.wiki/feedback/',
-          '- https://github.com/hsmusic/',
-        ] : [
-          'https://github.com/hsmusic/',
-        ],
-        '***',
-        buildTime &&
-          `Site built: ${buildTime.toLocaleString('en-US', {
-            dateStyle: 'long',
-            timeStyle: 'long',
-          })}`,
-        commit &&
-          `Latest code commit: ${commit}`,
-      ]
-        .filter(Boolean)
-        .map(line => `    ` + line)
-        .join('\n') + `\n-->`,
+      developersComment,
 
       html.tag('head', [
         html.tag('title',