From 6a99486d361b1fb8af6be08cb9c1adbbcd0b0e8f Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 6 Oct 2025 15:23:25 -0300 Subject: content, client: memorable details, collapsed crediting/ref sources --- .../dependencies/generateContentContentHeading.js | 51 ++++++++++++++++++---- 1 file changed, 43 insertions(+), 8 deletions(-) (limited to 'src/content/dependencies/generateContentContentHeading.js') diff --git a/src/content/dependencies/generateContentContentHeading.js b/src/content/dependencies/generateContentContentHeading.js index 555abb6b..54ffa205 100644 --- a/src/content/dependencies/generateContentContentHeading.js +++ b/src/content/dependencies/generateContentContentHeading.js @@ -9,7 +9,9 @@ export default { data: (thing) => ({ name: - thing.name, + (thing + ? thing.name + : null), }), slots: { @@ -21,6 +23,11 @@ export default { string: { type: 'string', }, + + summary: { + type: 'boolean', + default: false, + }, }, generate: (data, relations, slots, {html, language}) => @@ -28,14 +35,42 @@ export default { attributes: slots.attributes, title: - slots.string && - language.$(slots.string, { - thing: - html.tag('i', data.name), - }), + (() => { + if (!slots.string) return html.blank(); + + const options = {}; + + if (slots.summary) { + options.cue = + html.tag('span', {class: 'cue'}, + language.$(slots.string, 'cue')); + } + + if (data.name) { + options.thing = html.tag('i', data.name); + } + + if (slots.summary) { + return html.tags([ + html.tag('span', {class: 'when-open'}, + language.$(slots.string, options)), + + html.tag('span', {class: 'when-collapsed'}, + language.$(slots.string, 'collapsed', options)), + ]); + } else { + return language.$(slots.string, options); + } + })(), stickyTitle: - slots.string && - language.$(slots.string, 'sticky'), + (slots.string + ? language.$(slots.string, 'sticky') + : html.blank()), + + tag: + (slots.summary + ? 'summary' + : 'p'), }), }; -- cgit 1.3.0-6-gf8a5