« 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/generateFooterLocalizationLinks.js56
-rw-r--r--src/misc-templates.js38
-rw-r--r--src/write/bind-utilities.js4
-rw-r--r--src/write/build-modes/live-dev-server.js2
-rw-r--r--src/write/page-template.js4
5 files changed, 60 insertions, 44 deletions
diff --git a/src/content/dependencies/generateFooterLocalizationLinks.js b/src/content/dependencies/generateFooterLocalizationLinks.js
new file mode 100644
index 00000000..01b5b209
--- /dev/null
+++ b/src/content/dependencies/generateFooterLocalizationLinks.js
@@ -0,0 +1,56 @@
+export default {
+  extraDependencies: [
+    'defaultLanguage',
+    'html',
+    'language',
+    'languages',
+    'pagePath',
+    'to',
+  ],
+
+  generate({
+    defaultLanguage,
+    html,
+    language,
+    languages,
+    pagePath,
+    to,
+  }) {
+    const links = Object.entries(languages)
+      .filter(([code, language]) => code !== 'default' && !language.hidden)
+      .map(([code, language]) => language)
+      .sort(({name: a}, {name: b}) => (a < b ? -1 : a > b ? 1 : 0))
+      .map((language) =>
+        html.tag('span',
+          html.tag('a',
+            {
+              href:
+                language === defaultLanguage
+                  ? to(
+                      'localizedDefaultLanguage.' + pagePath[0],
+                      ...pagePath.slice(1))
+                  : to(
+                      'localizedWithBaseDirectory.' + pagePath[0],
+                      language.code,
+                      ...pagePath.slice(1)),
+            },
+            language.name)));
+
+    return html.tag('div', {class: 'footer-localization-links'},
+      language.$('misc.uiLanguage', {
+        languages: links.join('\n'),
+      }));
+  },
+};
+
+/*
+function unbound_getFooterLocalizationLinks({
+  html,
+  defaultLanguage,
+  language,
+  languages,
+  pagePath,
+  to,
+}) {
+}
+*/
diff --git a/src/misc-templates.js b/src/misc-templates.js
index 18429709..a8a207a3 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -463,42 +463,6 @@ function unbound_generateStickyHeadingContainer({
     ]);
 }
 
-// Footer stuff
-
-function unbound_getFooterLocalizationLinks({
-  html,
-  defaultLanguage,
-  language,
-  languages,
-  pagePath,
-  to,
-}) {
-  const links = Object.entries(languages)
-    .filter(([code, language]) => code !== 'default' && !language.hidden)
-    .map(([code, language]) => language)
-    .sort(({name: a}, {name: b}) => (a < b ? -1 : a > b ? 1 : 0))
-    .map((language) =>
-      html.tag('span',
-        html.tag('a',
-          {
-            href:
-              language === defaultLanguage
-                ? to(
-                    'localizedDefaultLanguage.' + pagePath[0],
-                    ...pagePath.slice(1))
-                : to(
-                    'localizedWithBaseDirectory.' + pagePath[0],
-                    language.code,
-                    ...pagePath.slice(1)),
-          },
-          language.name)));
-
-  return html.tag('div', {class: 'footer-localization-links'},
-    language.$('misc.uiLanguage', {
-      languages: links.join('\n'),
-    }));
-}
-
 // Exports
 
 export {
@@ -516,6 +480,4 @@ export {
   unbound_generateNavigationLinks as generateNavigationLinks,
 
   unbound_generateStickyHeadingContainer as generateStickyHeadingContainer,
-
-  unbound_getFooterLocalizationLinks as getFooterLocalizationLinks,
 }
diff --git a/src/write/bind-utilities.js b/src/write/bind-utilities.js
index 50596a39..be9ad66c 100644
--- a/src/write/bind-utilities.js
+++ b/src/write/bind-utilities.js
@@ -26,6 +26,7 @@ export function bindUtilities({
   getSizeOfImageFile,
   language,
   languages,
+  pagePath,
   to,
   urls,
   wikiData,
@@ -44,10 +45,11 @@ export function bindUtilities({
     html,
     language,
     languages,
+    pagePath,
     thumb,
     to,
     urls,
-    wikiData,
+    wikiInfo: wikiData.wikiInfo,
   });
 
   bound.getColors = bindOpts(getColors, {chroma});
diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js
index 129ac9ab..6dbcf3ee 100644
--- a/src/write/build-modes/live-dev-server.js
+++ b/src/write/build-modes/live-dev-server.js
@@ -20,7 +20,6 @@ import {
 } from '../../util/urls.js';
 
 import {
-  generateDocumentHTML,
   generateGlobalWikiDataJSON,
   generateRedirectHTML,
 } from '../page-template.js';
@@ -350,6 +349,7 @@ export async function go({
         getSizeOfImageFile,
         language,
         languages,
+        pagePath: servePath,
         to,
         urls,
         wikiData,
diff --git a/src/write/page-template.js b/src/write/page-template.js
index 1c448fc7..d3d7b098 100644
--- a/src/write/page-template.js
+++ b/src/write/page-template.js
@@ -3,10 +3,6 @@ import chroma from 'chroma-js';
 import * as html from '../util/html.js';
 import {getColors} from '../util/colors.js';
 
-import {
-  getFooterLocalizationLinks,
-} from '../misc-templates.js';
-
 export function generateDevelopersCommentHTML({
   buildTime,
   commit,