« get me outta code hell

content: generateAlbumCommentaryPage: stub commentary pages - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateAlbumCommentaryPage.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-12-19 12:49:08 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-12-19 13:25:17 -0400
commitd4318084d64209c26bda6464b25dcd53f7479086 (patch)
tree45775979a56cd9d2558d456a80646cfb9586ad98 /src/content/dependencies/generateAlbumCommentaryPage.js
parentbedb26b8b1054a98a820de412daf3d8b5b0dc0d6 (diff)
content: generateAlbumCommentaryPage: stub commentary pages
Diffstat (limited to 'src/content/dependencies/generateAlbumCommentaryPage.js')
-rw-r--r--src/content/dependencies/generateAlbumCommentaryPage.js26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/content/dependencies/generateAlbumCommentaryPage.js b/src/content/dependencies/generateAlbumCommentaryPage.js
index 61d9ca95..e323ed39 100644
--- a/src/content/dependencies/generateAlbumCommentaryPage.js
+++ b/src/content/dependencies/generateAlbumCommentaryPage.js
@@ -146,14 +146,24 @@ export default {
         mainClasses: ['long-content'],
         mainContent: [
           html.tag('p',
-            language.$(pageCapsule, 'infoLine', {
-              words:
-                html.tag('b',
-                  language.formatWordCount(data.wordCount, {unit: true})),
-
-              entries:
-                html.tag('b',
-                  language.countCommentaryEntries(data.entryCount, {unit: true})),
+            language.encapsulate(pageCapsule, 'infoLine', workingCapsule => {
+              const workingOptions = {};
+
+              if (data.entryCount >= 1) {
+                workingOptions.words =
+                  html.tag('b',
+                    language.formatWordCount(data.wordCount, {unit: true}));
+
+                workingOptions.entries =
+                  html.tag('b',
+                    language.countCommentaryEntries(data.entryCount, {unit: true}));
+              }
+
+              if (data.entryCount === 0) {
+                workingCapsule += '.withoutCommentary';
+              }
+
+              return language.$(workingCapsule, workingOptions);
             })),
 
           relations.albumCommentaryEntries &&