From 88c0d66fbb00a14fb2a40b05a89f16f3bec52ec0 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 28 Jun 2022 09:07:23 -0300 Subject: tagification album commentary progress --- src/page/album-commentary.js | 128 +++++++++++++------------------------------ 1 file changed, 38 insertions(+), 90 deletions(-) (limited to 'src/page') diff --git a/src/page/album-commentary.js b/src/page/album-commentary.js index 255a6584..43b8c8d6 100644 --- a/src/page/album-commentary.js +++ b/src/page/album-commentary.js @@ -4,8 +4,7 @@ // Imports -import fixWS from 'fix-whitespace'; - +import * as html from '../util/html.js'; import {filterAlbumsByCommentary} from '../util/wiki-data.js'; // Page exports @@ -40,53 +39,29 @@ export function write(album) { theme: getThemeString(album.color), main: { - content: fixWS` -
-

${language.$('albumCommentaryPage.title', { - album: link.album(album), - })}

-

${language.$('albumCommentaryPage.infoLine', { - words: `${language.formatWordCount(words, { - unit: true, - })}`, - entries: `${language.countCommentaryEntries( - entries.length, - { - unit: true, - } - )}`, - })}

- ${ - album.commentary && - fixWS` -

${language.$( - 'albumCommentaryPage.entry.title.albumCommentary' - )}

-
- ${transformMultiline(album.commentary)} -
- ` - } - ${album.tracks - .filter((t) => t.commentary) - .map( - (track) => fixWS` -

${language.$( - 'albumCommentaryPage.entry.title.trackCommentary', - { - track: link.track(track), - } - )}

-
- ${transformMultiline(track.commentary)} -
- ` - ) - .join('\n')} -
- `, + content: html.tag('div', {class: 'long-content'}, [ + html.tag('h1', language.$('albumCommentaryPage.title', { + album: link.album(album), + })), + html.tag('p', language.$('albumCommentaryPage.infoLine', { + words: html.tag('b', language.formatWordCount(words, {unit: true})), + entries: html.tag('b', language.countCommentaryEntries(entries.length, {unit: true})), + })), + ...album.commentary ? [ + html.tag('h3', language.$('albumCommentaryPage.entry.title.albumCommentary')), + html.tag('blockquote', transformMultiline(album.commentary)), + ] : [], + ...album.tracks.filter(t => t.commentary).flatMap(track => [ + html.tag('h3', + {id: 'track.directory'}, + language.$('albumCommentaryPage.entry.title.trackCommentary', { + track: link.track(track), + })), + html.tag('blockquote', + {style: getLinkThemeString(track.color)}, + transformMultiline(track.commentary)), + ]) + ]), }, nav: { @@ -134,47 +109,20 @@ export function writeTargetless({wikiData}) { title: language.$('commentaryIndex.title'), main: { - content: fixWS` -
-

${language.$('commentaryIndex.title')}

-

${language.$('commentaryIndex.infoLine', { - words: `${language.formatWordCount(totalWords, { - unit: true, - })}`, - entries: `${language.countCommentaryEntries( - totalEntries, - { - unit: true, - } - )}`, - })}

-

${language.$('commentaryIndex.albumList.title')}

- -
- `, + content: html.tag('div', {class: 'long-content'}, [ + html.tag('h1', language.$('commentaryIndex.title')), + html.tag('p', language.$('commentaryIndex.infoLine', { + words: html.tag('b', language.formatWordCount(totalWords, {unit: true})), + entries: html.tag('b', language.countCommentaryEntries(totalEntries, {unit: true})), + })), + html.tag('p', language.$('commentaryIndex.albumList.title')), + html.tag('ul', data.map(({album, entries, words}) => + html.tag('li', language.$('commentaryIndex.albumList.item', { + album: link.albumCommentary(album), + words: language.formatWordCount(words, {unit: true}), + entries: language.countCommentaryEntries(entries.length, {unit: true}), + })))) + ]), }, nav: {simple: true}, -- cgit 1.3.0-6-gf8a5