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
|
export default {
contentDependencies: ['transformContent'],
extraDependencies: ['html', 'language'],
relations: (relation, thing) => ({
customName:
(thing.nameText
? relation('transformContent', thing.nameText)
: null),
}),
data: (thing) => ({
normalName:
thing.name,
shortName:
thing.nameShort,
}),
slots: {
preferShortName: {
type: 'boolean',
default: false,
},
},
generate: (data, relations, slots, {language}) =>
(relations.customName
? relations.customName.slot('mode', 'inline')
: slots.preferShortName && data.shortName
? language.sanitize(data.shortName)
: language.sanitize(data.normalName)),
};
|