1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
export default {
extraDependencies: [
'html',
'language',
],
data(additionalFiles, {fileSize = true} = {}) {
return {
// Additional files are already a serializable format.
additionalFiles,
showFileSizes: fileSize,
};
},
generate(data, {
html,
language,
}) {
return html.template(slot =>
html.tag('dl',
data.additionalFiles.flatMap(({title, description, files}) => [
html.tag('dt',
(description
? language.$('releaseInfo.additionalFiles.entry.withDescription', {
title,
description,
})
: language.$('releaseInfo.additionalFiles.entry', {title}))),
slot('additionalFileLinks', ([fileLinks]) =>
slot('additionalFileSizes', ([fileSizes]) =>
html.tag('dd',
html.tag('ul',
files.map(file =>
html.tag('li',
(fileSizes[file]
? language.$('releaseInfo.additionalFiles.file.withSize', {
file: fileLinks[file],
size: language.formatFileSize(fileSizes[file]),
})
: language.$('releaseInfo.additionalFiles.file', {
file: fileLinks[file],
})))))))),
])));
},
};
|