diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-03-18 11:10:58 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-03-18 11:10:58 +0100 |
commit | 82d8c3e2d954f06fb97644ae0934dbd4c3df8cb3 (patch) | |
tree | e63cf2c4d5ff7cfb8f820213e10173e88330eea9 /lib/parsers.js | |
parent | bc0c8dbcf3ef060d99cafb27b9a414a3009c4a5f (diff) | |
download | gitbook-82d8c3e2d954f06fb97644ae0934dbd4c3df8cb3.zip gitbook-82d8c3e2d954f06fb97644ae0934dbd4c3df8cb3.tar.gz gitbook-82d8c3e2d954f06fb97644ae0934dbd4c3df8cb3.tar.bz2 |
Add method renderInline and renderBlock to book
Diffstat (limited to 'lib/parsers.js')
-rw-r--r-- | lib/parsers.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/parsers.js b/lib/parsers.js index 6899865..a27ddd0 100644 --- a/lib/parsers.js +++ b/lib/parsers.js @@ -37,11 +37,20 @@ function createParser(parser, base) { nparser.page = Promise.wrapfn(parser.page); nparser.page.prepare = Promise.wrapfn(parser.page.prepare || _.identity); + nparser.inline = Promise.wrapfn(parser.inline); + return nparser; } +// Return a specific parser +function getParser(name) { + return _.find(PARSERS, { + name: name + }); +} + // Return a specific parser according to an extension -function getParser(ext) { +function getParserByExt(ext) { return _.find(PARSERS, function(input) { return input.name == ext || _.contains(input.extensions, ext); }); @@ -56,5 +65,6 @@ module.exports = { all: PARSERS, extensions: _.flatten(_.pluck(PARSERS, 'extensions')), get: getParser, + getByExt: getParserByExt, getForFile: getParserForFile }; |