From 535acb34613b5cf7e22654619f4337b94b70644d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 12 Jun 2023 16:35:38 -0300 Subject: content: cut html.template boilerplate --- .../dependencies/generatePreviousNextLinks.js | 44 ++++++++++------------ 1 file changed, 19 insertions(+), 25 deletions(-) (limited to 'src/content/dependencies/generatePreviousNextLinks.js') diff --git a/src/content/dependencies/generatePreviousNextLinks.js b/src/content/dependencies/generatePreviousNextLinks.js index 42b2c42b..5bdcc3ad 100644 --- a/src/content/dependencies/generatePreviousNextLinks.js +++ b/src/content/dependencies/generatePreviousNextLinks.js @@ -5,32 +5,26 @@ export default { extraDependencies: ['html', 'language'], - generate({html, language}) { - return html.template({ - annotation: `generatePreviousNextLinks`, - - slots: { - previousLink: {type: 'html'}, - nextLink: {type: 'html'}, - }, + slots: { + previousLink: {type: 'html'}, + nextLink: {type: 'html'}, + }, - content(slots) { - return [ - !html.isBlank(slots.previousLink) && - slots.previousLink.slots({ - tooltip: true, - attributes: {id: 'previous-button'}, - content: language.$('misc.nav.previous'), - }), + generate(slots, {html, language}) { + return html.tags([ + !html.isBlank(slots.previousLink) && + slots.previousLink.slots({ + tooltip: true, + attributes: {id: 'previous-button'}, + content: language.$('misc.nav.previous'), + }), - !html.isBlank(slots.nextLink) && - slots.nextLink?.slots({ - tooltip: true, - attributes: {id: 'next-button'}, - content: language.$('misc.nav.next'), - }), - ].filter(Boolean); - }, - }); + !html.isBlank(slots.nextLink) && + slots.nextLink?.slots({ + tooltip: true, + attributes: {id: 'next-button'}, + content: language.$('misc.nav.next'), + }), + ]); }, }; -- cgit 1.3.0-6-gf8a5