summaryrefslogtreecommitdiffstats
path: root/lib/constants/defaultBlocks.js
blob: 74d1f1f369414f0a544e686857c8222d8e7b774b (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
47
48
49
50
51
var Immutable = require('immutable');
var TemplateBlock = require('../models/templateBlock');

module.exports = Immutable.Map({
    html: TemplateBlock({
        name: 'html',
        process: function(blk) {
            return blk;
        }
    }),

    code: TemplateBlock({
        name: 'code',
        process: function(blk) {
            return {
                html: false,
                body: blk.body
            };
        }
    }),

    markdown: TemplateBlock({
        name: 'markdown',
        process: function(blk) {
            return this.book.renderInline('markdown', blk.body)
            .then(function(out) {
                return { body: out };
            });
        }
    }),

    asciidoc: TemplateBlock({
        name: 'asciidoc',
        process: function(blk) {
            return this.book.renderInline('asciidoc', blk.body)
            .then(function(out) {
                return { body: out };
            });
        }
    }),

    markup: TemplateBlock({
        name: 'markup',
        process: function(blk) {
            return this.book.renderInline(this.ctx.file.type, blk.body)
            .then(function(out) {
                return { body: out };
            });
        }
    })
});