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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
import {empty} from '#sugar';
export default {
contentDependencies: [
'generateCommentaryEntryDate',
'generateColorStyleAttribute',
'linkArtist',
'transformContent',
],
extraDependencies: ['html', 'language'],
relations: (relation, entry) => ({
artistLinks:
(!empty(entry.artists) && !entry.artistDisplayText
? entry.artists
.map(artist => relation('linkArtist', artist))
: null),
artistsContent:
(entry.artistDisplayText
? relation('transformContent', entry.artistDisplayText)
: null),
annotationContent:
(entry.annotation
? relation('transformContent', entry.annotation)
: null),
bodyContent:
(entry.body
? relation('transformContent', entry.body)
: null),
colorStyle:
relation('generateColorStyleAttribute'),
date:
relation('generateCommentaryEntryDate', entry),
}),
slots: {
color: {validate: v => v.isColor},
},
generate: (relations, slots, {html, language}) =>
language.encapsulate('misc.artistCommentary.entry', entryCapsule =>
html.tags([
html.tag('p', {class: 'commentary-entry-heading'},
slots.color &&
relations.colorStyle.clone()
.slot('color', slots.color),
language.encapsulate(entryCapsule, 'title', titleCapsule => [
html.tag('span', {class: 'commentary-entry-heading-text'},
language.encapsulate(titleCapsule, workingCapsule => {
const workingOptions = {};
workingOptions.artists =
html.tag('span', {class: 'commentary-entry-artists'},
(relations.artistsContent
? relations.artistsContent.slot('mode', 'inline')
: relations.artistLinks
? language.formatConjunctionList(relations.artistLinks)
: language.$(titleCapsule, 'noArtists')));
const accent =
html.tag('span', {class: 'commentary-entry-accent'},
{[html.onlyIfContent]: true},
language.encapsulate(titleCapsule, 'accent', accentCapsule =>
language.encapsulate(accentCapsule, workingCapsule => {
const workingOptions = {};
if (relations.annotationContent) {
workingCapsule += '.withAnnotation';
workingOptions.annotation =
relations.annotationContent.slots({
mode: 'inline',
absorbPunctuationFollowingExternalLinks: false,
});
}
if (workingCapsule === accentCapsule) {
return html.blank();
} else {
return language.$(workingCapsule, workingOptions);
}
})));
if (!html.isBlank(accent)) {
workingCapsule += '.withAccent';
workingOptions.accent = accent;
}
return language.$(workingCapsule, workingOptions);
})),
relations.date,
])),
html.tag('blockquote', {class: 'commentary-entry-body'},
slots.color &&
relations.colorStyle.clone()
.slot('color', slots.color),
relations.bodyContent.slot('mode', 'multiline')),
])),
};
|