summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-asciidoc/lib/toasciidoc.js
blob: cb329211a0d6eb0529fe342f096f0e7145666f05 (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

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

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

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

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

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

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