« get me outta code hell

generateMusicVideoArtistsLine.js « dependencies « content « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateMusicVideoArtistsLine.js
blob: f79fdc8cb43e4ee117c20ad34c27eab8291b39fc (plain)
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
export default {
  relations: (relation, musicVideo) => ({
    artistCredit:
      relation('generateArtistCredit', musicVideo.artistContribs, []),
  }),

  data: (musicVideo) => ({
    label:
      (musicVideo.label !== 'Music video'
        ? musicVideo.label
        : null),
  }),

  generate: (data, relations, {html, language}) =>
    language.encapsulate('misc.musicVideo.artistsLine', artistsLineCapsule =>
      language.encapsulate(artistsLineCapsule, workingCapsule => {
        const workingOptions = {[language.onlyIfOptions]: ['credit']};

        if (data.label) {
          workingCapsule += '.customLabel';
          workingOptions.label = data.label;
        }

        workingOptions.credit =
          html.tag('span', {class: 'by'},
            {[html.onlyIfContent]: true},

            relations.artistCredit.slots({
              normalStringKey:
                language.encapsulate(artistsLineCapsule, 'credit'),

              showAnnotation: true,
              showChronology: true,

              chronologyKind: 'musicVideo',
            }));

        return language.$(workingCapsule, workingOptions);
      })),
};