diff options
Diffstat (limited to 'src/content/dependencies/generateAdditionalFilesListChunk.js')
-rw-r--r-- | src/content/dependencies/generateAdditionalFilesListChunk.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/content/dependencies/generateAdditionalFilesListChunk.js b/src/content/dependencies/generateAdditionalFilesListChunk.js new file mode 100644 index 00000000..bb16b778 --- /dev/null +++ b/src/content/dependencies/generateAdditionalFilesListChunk.js @@ -0,0 +1,39 @@ +export default { + extraDependencies: ['html', 'language'], + + slots: { + title: { + type: 'html', + mutable: false, + }, + + description: { + type: 'html', + mutable: false, + }, + + items: { + validate: v => v.looseArrayOf(v.isHTML), + }, + }, + + generate(slots, {html, language}) { + const titleParts = ['releaseInfo.additionalFiles.entry']; + const titleOptions = {title: slots.title}; + + if (!html.isBlank(slots.description)) { + titleParts.push('withDescription'); + titleOptions.description = slots.description; + } + + const dt = + html.tag('dt', + language.$(...titleParts, titleOptions)); + + const dd = + html.tag('dd', + html.tag('ul', slots.items)); + + return html.tags([dt, dd]); + }, +}; |