« get me outta code hell

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:
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 &&