summaryrefslogtreecommitdiffstats
path: root/test/plugins/blocks/index.js
blob: 0a02ff7a25e9606d6bd9668e9c29153d01950163 (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
var assert = require("assert");

module.exports = {
    blocks: {
    	"test": {
            shortcuts: {
                parsers:  ["markdown"],
                start: "$$",
                end: "$$"
            },
    		process: function(blk) {
    			return "test"+blk.body+"test";
    		}
    	},
    	"test2": {
    		end: "endtest2end",
    		process: function(blk) {
    			return "test2"+blk.body+"test2";
    		}
    	},
        "test3join": {
            blocks: [
                "also"
            ],
            process: function(blk) {
                return [blk.body, blk.blocks[0].body].join(blk.kwargs.separator);
            }
        },
        "test4join": {
            blocks: [
                "also", "finally"
            ],
            process: function(blk) {
                assert(blk.blocks.length, 2);
                assert(blk.blocks[0].name, "also");
                assert(blk.blocks[1].name, "finally");
                return [blk.body, blk.blocks[0].body, blk.blocks[1].body].join(blk.kwargs.separator);
            }
        }
    }
};