summaryrefslogtreecommitdiffstats
path: root/lib/constants/defaultBlocks.js
blob: ed1911565d29bc5a4933f805d7baa4365f9526b8 (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.List([
    TemplateBlock({
        name: 'html',
        process: function(blk) {
            return blk;
        }
    }),

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

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

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

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