summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-asciidoc/src/toAsciidoc.js
blob: 77759d814599799429f2eab49d52a8cd0a0c11f9 (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
41
42
43
44
45
46

// Return N time a string
function ns(s, n) {
    return Array(n + 1).join(s);
}

module.exports = {
    onTitleStart(level) {
        return ns('=', level) + ' ';
    },
    onTitleEnd(level) {
        return this.onBL();
    },

    onParagraphStart() {
        return this.onSection();
    },
    onParagraphEnd() {
        return this.onSection();
    },

    onLinkStart(href) {
        return 'link:' + href + '[';
    },
    onLinkEnd() {
        return ']';
    },

    onListStart(level) {
        return '';
    },
    onListEnd() {
        return '';
    },

    onListItemStart(level) {
        return ns('.', level + 1) + ' ';
    },
    onListItemEnd() {
        return '';
    },

    onHR() {
        return '\'\'\'';
    }
};