diff options
author | (quasar) nebula <towerofnix@gmail.com> | 2021-06-04 17:30:16 -0300 |
---|---|---|
committer | (quasar) nebula <towerofnix@gmail.com> | 2021-06-04 17:30:16 -0300 |
commit | b2469c03bd4bdb29c5e80752f812203a6755c159 (patch) | |
tree | 85f951c70568457a78c25055bb600709de4214cb /src/page/listing.js | |
parent | c7e4b06ff1e899659f043ebfbd3723152b0c93d9 (diff) |
move around a bunch of utility functions
Diffstat (limited to 'src/page/listing.js')
-rw-r--r-- | src/page/listing.js | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/src/page/listing.js b/src/page/listing.js index b0766b28..d4021747 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` - <h1>${listing.title({strings})}</h1> - ${listing.html && (listing.data - ? listing.html(data, {link, strings}) - : listing.html({link, strings}))} - ${listing.row && fixWS` - <ul> - ${(data - .map(item => listing.row(item, {link, strings})) - .map(row => `<li>${row}</li>`) - .join('\n'))} - </ul> - `} - ` - }, - - 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` + <h1>${listing.title({strings})}</h1> + ${listing.html && (listing.data + ? listing.html(data, opts) + : listing.html(opts))} + ${listing.row && fixWS` + <ul> + ${(data + .map(item => listing.row(item, opts)) + .map(row => `<li>${row}</li>`) + .join('\n'))} + </ul> + `} + ` + }, + + sidebarLeft: { + content: generateSidebarForListings(listing, {link, strings, wikiData}) + }, + + nav: { + links: [ + {toHome: true}, + { + path: ['localized.listingIndex'], + title: strings('listingIndex.title') + }, + {toCurrentPage: true} + ] + } + }; + } }; return [page]; |