diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-04-24 19:12:03 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-04-24 19:12:03 +0200 |
commit | 93b257314aa9a6ba240ff7d9534ddb1a6ded6bc0 (patch) | |
tree | fdb9103fe3d32c34326b7a13746668e2056a40de /lib/constants/defaultBlocks.js | |
parent | 19a1db8cb43431352d30dbc48aebb9cc8bf58eec (diff) | |
download | gitbook-93b257314aa9a6ba240ff7d9534ddb1a6ded6bc0.zip gitbook-93b257314aa9a6ba240ff7d9534ddb1a6ded6bc0.tar.gz gitbook-93b257314aa9a6ba240ff7d9534ddb1a6ded6bc0.tar.bz2 |
Add default filters and blocks
Diffstat (limited to 'lib/constants/defaultBlocks.js')
-rw-r--r-- | lib/constants/defaultBlocks.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/constants/defaultBlocks.js b/lib/constants/defaultBlocks.js new file mode 100644 index 0000000..5d91359 --- /dev/null +++ b/lib/constants/defaultBlocks.js @@ -0,0 +1,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 }; + }); + } + }), +]); |