« get me outta code hell

content, css: generateAlbumTrackList: track section descriptions - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-07-31 09:33:35 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-07-31 09:33:35 -0300
commitdd3ab6268bc13d259e6d5fe38bb326d50291b227 (patch)
tree452d9410050a120039cc1c3a8828feffeb4a1d35
parent6c256d71e923b6301037c843a34f4a893f787b96 (diff)
content, css: generateAlbumTrackList: track section descriptions
-rw-r--r--src/content/dependencies/generateAlbumTrackList.js22
-rw-r--r--src/static/css/site.css14
2 files changed, 33 insertions, 3 deletions
diff --git a/src/content/dependencies/generateAlbumTrackList.js b/src/content/dependencies/generateAlbumTrackList.js
index a3435bea..9743c750 100644
--- a/src/content/dependencies/generateAlbumTrackList.js
+++ b/src/content/dependencies/generateAlbumTrackList.js
@@ -35,7 +35,12 @@ function getDisplayMode(album) {
 }
 
 export default {
-  contentDependencies: ['generateAlbumTrackListItem', 'generateContentHeading'],
+  contentDependencies: [
+    'generateAlbumTrackListItem',
+    'generateContentHeading',
+    'transformContent',
+  ],
+
   extraDependencies: ['html', 'language'],
 
   query(album) {
@@ -53,6 +58,10 @@ export default {
           album.trackSections.map(() =>
             relation('generateContentHeading'));
 
+        relations.trackSectionDescriptions =
+          album.trackSections.map(section =>
+            relation('transformContent', section.description));
+
         relations.trackSectionItems =
           album.trackSections.map(section =>
             section.tracks.map(track =>
@@ -132,6 +141,7 @@ export default {
         return html.tag('dl', {class: 'album-group-list'},
           stitchArrays({
             heading: relations.trackSectionHeadings,
+            description: relations.trackSectionDescriptions,
             items: relations.trackSectionItems,
 
             name: data.trackSectionNames,
@@ -140,6 +150,7 @@ export default {
             startIndex: data.trackSectionStartIndices,
           }).map(({
               heading,
+              description,
               items,
 
               name,
@@ -172,12 +183,17 @@ export default {
                     }),
                 })),
 
-              html.tag('dd',
+              html.tag('dd', [
+                html.tag('blockquote',
+                  {[html.onlyIfContent]: true},
+                  description),
+
                 html.tag(listTag,
                   data.hasTrackNumbers &&
                     {start: startIndex + 1},
 
-                  slotItems(items))),
+                  slotItems(items)),
+              ]),
             ]));
 
       case 'tracks':
diff --git a/src/static/css/site.css b/src/static/css/site.css
index 8d3ab0ae..92749110 100644
--- a/src/static/css/site.css
+++ b/src/static/css/site.css
@@ -1528,6 +1528,20 @@ ul > li.has-details {
   margin-left: 0;
 }
 
+.album-group-list blockquote {
+  max-width: 540px;
+  margin-bottom: 9px;
+  margin-top: 3px;
+}
+
+.album-group-list blockquote p:first-child {
+  margin-top: 0;
+}
+
+.album-group-list blockquote p:last-child {
+  margin-bottom: 0;
+}
+
 .group-chronology-link {
   font-style: oblique;
 }