From b2469c03bd4bdb29c5e80752f812203a6755c159 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 4 Jun 2021 17:30:16 -0300 Subject: move around a bunch of utility functions --- src/page/listing.js | 77 +++++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 38 deletions(-) (limited to 'src/page/listing.js') diff --git a/src/page/listing.js b/src/page/listing.js index b0766b2..d402174 100644 --- a/src/page/listing.js +++ b/src/page/listing.js @@ -46,44 +46,45 @@ export function write(listing, {wikiData}) { const page = { type: 'page', path: ['listing', listing.directory], - page: ({ - link, - strings - }) => ({ - title: listing.title({strings}), - - main: { - content: fixWS` -

${listing.title({strings})}

- ${listing.html && (listing.data - ? listing.html(data, {link, strings}) - : listing.html({link, strings}))} - ${listing.row && fixWS` - - `} - ` - }, - - sidebarLeft: { - content: generateSidebarForListings(listing, {link, strings, wikiData}) - }, - - nav: { - links: [ - {toHome: true}, - { - path: ['localized.listingIndex'], - title: strings('listingIndex.title') - }, - {toCurrentPage: true} - ] - } - }) + page: opts => { + const { link, strings } = opts; + + return { + title: listing.title({strings}), + + main: { + content: fixWS` +

${listing.title({strings})}

+ ${listing.html && (listing.data + ? listing.html(data, opts) + : listing.html(opts))} + ${listing.row && fixWS` + + `} + ` + }, + + sidebarLeft: { + content: generateSidebarForListings(listing, {link, strings, wikiData}) + }, + + nav: { + links: [ + {toHome: true}, + { + path: ['localized.listingIndex'], + title: strings('listingIndex.title') + }, + {toCurrentPage: true} + ] + } + }; + } }; return [page]; -- cgit 1.3.0-6-gf8a5