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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
export default {
contentDependencies: ['linkArtist', 'linkExternal', 'transformContent'],
extraDependencies: ['html', 'language'],
relations: (relation, entry) => ({
content:
relation('transformContent', entry.body),
artistText:
relation('transformContent', entry.artistText),
artistLinks:
entry.artists
.filter(artist => artist.name !== 'HSMusic Wiki') // smh
.map(artist => relation('linkArtist', artist)),
sourceLinks:
entry.sourceURLs
.map(url => relation('linkExternal', url)),
}),
data: (entry) => ({
isWikiLyrics:
entry.isWikiLyrics,
}),
slots: {
attributes: {
type: 'attributes',
mutable: false,
},
},
generate: (data, relations, slots, {html, language}) =>
language.encapsulate('misc.lyrics', capsule =>
html.tag('div', {class: 'lyrics-entry'},
slots.attributes,
[
html.tag('p', {class: 'lyrics-details'},
{[html.onlyIfContent]: true},
{[html.joinChildren]: html.tag('br')},
[
language.$(capsule, 'source', {
[language.onlyIfOptions]: ['source'],
source:
language.formatUnitList(
relations.sourceLinks.map(link =>
link.slots({
indicateExternal: true,
tab: 'separate',
}))),
}),
data.isWikiLyrics &&
language.$(capsule, 'contributors', {
[language.onlyIfOptions]: ['contributors'],
contributors:
(html.isBlank(relations.artistText)
? language.formatUnitList(relations.artistLinks)
: relations.artistText.slot('mode', 'inline')),
}),
]),
relations.content.slot('mode', 'lyrics'),
])),
};
|