From 76833c4083648d11780b0bbc9dd4de05479db240 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 25 Jan 2023 14:51:00 -0400 Subject: data-ize various page content calls * page.cover replaces calls to generateCoverLink * page.main.headingMode replaces calls to generateStickyHeadingContainer or html.tag('h1') * page.main.classes: ['long-content'] replaces hard- coded calls to html.tag('div', {class: 'long-content'}) --- src/page/news.js | 81 +++++++++++++++++++++++--------------------------------- 1 file changed, 33 insertions(+), 48 deletions(-) (limited to 'src/page/news.js') diff --git a/src/page/news.js b/src/page/news.js index 61a52dc0..020b9a60 100644 --- a/src/page/news.js +++ b/src/page/news.js @@ -14,7 +14,6 @@ export function write(entry, {wikiData}) { path: ['newsEntry', entry.directory], page: ({ generateNavigationLinks, - generateStickyHeadingContainer, html, language, link, @@ -23,22 +22,16 @@ export function write(entry, {wikiData}) { title: language.$('newsEntryPage.title', {entry: entry.name}), main: { + classes: ['long-content'], + headingMode: 'sticky', + content: [ - generateStickyHeadingContainer({ - class: ['long-content'], - title: language.$('newsEntryPage.title', { - entry: entry.name, - }), - }), - - html.tag('div', {class: 'long-content'}, [ - html.tag('p', - language.$('newsEntryPage.published', { - date: language.formatDate(entry.date), - })), - - transformMultiline(entry.content), - ]), + html.tag('p', + language.$('newsEntryPage.published', { + date: language.formatDate(entry.date), + })), + + transformMultiline(entry.content), ], }, @@ -62,7 +55,6 @@ export function writeTargetless({wikiData}) { type: 'page', path: ['newsIndex'], page: ({ - generateStickyHeadingContainer, html, language, link, @@ -71,37 +63,30 @@ export function writeTargetless({wikiData}) { title: language.$('newsIndex.title'), main: { - content: [ - generateStickyHeadingContainer({ - class: ['long-content'], - title: language.$('newsIndex.title'), - }), - - html.tag('div', - {class: ['long-content', 'news-index']}, - [ - ...newsData.map(entry => - html.tag('article', - {id: entry.directory}, - [ - html.tag('h2', [ - html.tag('time', - language.formatDate(entry.date)), - link.newsEntry(entry), - ]), - - transformMultiline(entry.contentShort), - - entry.contentShort !== entry.content && - html.tag('p', - link.newsEntry(entry, { - text: language.$( - 'newsIndex.entry.viewRest' - ), - })), - ])), - ]), - ], + classes: ['long-content', 'news-index'], + headingMode: 'sticky', + + content: + newsData.map(entry => + html.tag('article', + {id: entry.directory}, + [ + html.tag('h2', [ + html.tag('time', + language.formatDate(entry.date)), + link.newsEntry(entry), + ]), + + transformMultiline(entry.contentShort), + + entry.contentShort !== entry.content && + html.tag('p', + link.newsEntry(entry, { + text: language.$( + 'newsIndex.entry.viewRest' + ), + })), + ])), }, nav: {simple: true}, -- cgit 1.3.0-6-gf8a5