« 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/generateContentEntry.js59
-rw-r--r--src/static/css/site.css2
-rw-r--r--src/strings-default.yaml12
3 files changed, 34 insertions, 39 deletions
diff --git a/src/content/dependencies/generateContentEntry.js b/src/content/dependencies/generateContentEntry.js
index 30d57f72..95c8f4b8 100644
--- a/src/content/dependencies/generateContentEntry.js
+++ b/src/content/dependencies/generateContentEntry.js
@@ -19,9 +19,7 @@ export default {
         : null),
 
     bodyContent:
-      (entry.body
-        ? relation('transformContent', entry.body)
-        : null),
+      relation('transformContent', entry.body),
 
     colorStyle:
       relation('generateColorStyleAttribute'),
@@ -55,41 +53,42 @@ export default {
               language.encapsulate(titleCapsule, workingCapsule => {
                 const workingOptions = {};
 
-                workingOptions.artists =
+                const artists =
                   html.tag('span', {class: 'content-entry-artists'},
+                    {[html.onlyIfContent]: true},
+
                     (relations.artistsContent
                       ? relations.artistsContent.slot('mode', 'inline')
                    : relations.artistLinks
                       ? language.formatConjunctionList(relations.artistLinks)
-                      : language.$(titleCapsule, 'noArtists')));
+                      : html.blank()));
+
+                if (!html.isBlank(artists)) {
+                  workingCapsule += '.withArtists';
+                  workingOptions.artists = artists;
+                }
 
-                const accent =
-                  html.tag('span', {class: 'content-entry-accent'},
+                const annotation =
+                  html.tag('span', {class: 'content-entry-annotation'},
                     {[html.onlyIfContent]: true},
 
-                    language.encapsulate(titleCapsule, 'accent', accentCapsule =>
-                      language.encapsulate(accentCapsule, workingCapsule => {
-                        const workingOptions = {};
-
-                        if (relations.annotationContent) {
-                          workingCapsule += '.withAnnotation';
-                          workingOptions.annotation =
-                            relations.annotationContent.slots({
-                              mode: 'inline',
-                              absorbPunctuationFollowingExternalLinks: false,
-                            });
-                        }
-
-                        if (workingCapsule === accentCapsule) {
-                          return html.blank();
-                        } else {
-                          return language.$(workingCapsule, workingOptions);
-                        }
-                      })));
-
-                if (!html.isBlank(accent)) {
-                  workingCapsule += '.withAccent';
-                  workingOptions.accent = accent;
+                    (relations.annotationContent
+                      ? relations.annotationContent.slots({
+                          mode: 'inline',
+                          absorbPunctuationFollowingExternalLinks: false,
+                        })
+                      : html.blank()));
+
+                if (!html.isBlank(annotation)) {
+                  if (html.isBlank(artists)) {
+                    workingCapsule += '.withAnnotation';
+                    workingOptions.annotation = annotation;
+                  } else {
+                    workingCapsule += '.withAccent';
+                    workingOptions.accent =
+                      html.tag('span', {class: 'content-entry-accent'},
+                        language.$(titleCapsule, 'accent.withAnnotation', {annotation}));
+                  }
                 }
 
                 return language.$(workingCapsule, workingOptions);
diff --git a/src/static/css/site.css b/src/static/css/site.css
index abcae399..9ad6cadd 100644
--- a/src/static/css/site.css
+++ b/src/static/css/site.css
@@ -2008,7 +2008,7 @@ p.image-details.origin-details .filename-line {
   border-bottom: 1px solid var(--dim-color);
 }
 
-.content-entry-accent {
+.content-entry-annotation {
   font-style: oblique;
 }
 
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index 28a5902c..7c48a5a8 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -517,14 +517,10 @@ misc:
 
     entry:
       title:
-        _: "{ARTISTS}:"
-
-        noArtists: "Unknown artist"
-
-        withAccent: "{ARTISTS}: {ACCENT}"
-
-        accent:
-          withAnnotation: "({ANNOTATION})"
+        withArtists: "{ARTISTS}"
+        withArtists.withAccent: "{ARTISTS}: {ACCENT}"
+        accent.withAnnotation: "({ANNOTATION})"
+        withAnnotation: "{ANNOTATION}"
 
         date: "{DATE}"
         date.range: "{DATE_RANGE}"