From 635eea4460bb635766bcf9d0a666b7d5ddb2dba3 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 4 Jun 2021 15:19:03 -0300 Subject: module-ify static pages --- src/page/index.js | 1 + src/page/static.js | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/page/static.js (limited to 'src/page') diff --git a/src/page/index.js b/src/page/index.js index 384b4193..42204947 100644 --- a/src/page/index.js +++ b/src/page/index.js @@ -43,5 +43,6 @@ export * as album from './album.js'; export * as artist from './artist.js'; export * as artistAlias from './artist-alias.js'; export * as group from './group.js'; +export * as static from './static.js'; export * as news from './news.js'; export * as track from './track.js'; diff --git a/src/page/static.js b/src/page/static.js new file mode 100644 index 00000000..ff57c4fb --- /dev/null +++ b/src/page/static.js @@ -0,0 +1,40 @@ +// Static content page specification. (These are static pages coded into the +// wiki data folder, used for a variety of purposes, e.g. wiki info, +// changelog, and so on.) + +// Imports + +import fixWS from 'fix-whitespace'; + +// Page exports + +export function targets({wikiData}) { + return wikiData.staticPageData; +} + +export function write(staticPage, {wikiData}) { + const page = { + type: 'page', + path: ['staticPage', staticPage.directory], + page: ({ + strings, + transformMultiline + }) => ({ + title: staticPage.name, + stylesheet: staticPage.stylesheet, + + main: { + content: fixWS` +
+

${staticPage.name}

+ ${transformMultiline(staticPage.content)} +
+ ` + }, + + nav: {simple: true} + }) + }; + + return [page]; +} -- cgit 1.3.0-6-gf8a5