From 9de8146884faf5d3681ddfa5d867d0ebacf1fc7a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 31 Jan 2026 17:33:31 -0400 Subject: content, css: generateContentEntry: artistless entries --- src/content/dependencies/generateContentEntry.js | 59 ++++++++++++------------ src/static/css/site.css | 2 +- src/strings-default.yaml | 12 ++--- 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}" -- cgit 1.3.0-6-gf8a5