« get me outta code hell

static.js « page « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/page/static.js
blob: e9b6a047fd2ce08847028afd2be1fce2e502ed1d (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
// Static content page specification. (These are static pages coded into the
// wiki data folder, used for a variety of purposes, e.g. wiki info,
// changelog, and so on.)

// Imports

import fixWS from 'fix-whitespace';

// Page exports

export function targets({wikiData}) {
    return wikiData.staticPageData;
}

export function write(staticPage, {wikiData}) {
    const page = {
        type: 'page',
        path: ['staticPage', staticPage.directory],
        page: ({
            language,
            transformMultiline
        }) => ({
            title: staticPage.name,
            stylesheet: staticPage.stylesheet,

            main: {
                content: fixWS`
                    <div class="long-content">
                        <h1>${staticPage.name}</h1>
                        ${transformMultiline(staticPage.content)}
                    </div>
                `
            },

            nav: {simple: true}
        })
    };

    return [page];
}