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/book.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/book.js')
-rw-r--r-- | lib/book.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/book.js b/lib/book.js index dac73f8..82f4440 100644 --- a/lib/book.js +++ b/lib/book.js @@ -320,7 +320,7 @@ Book.prototype.findParsableFile = function(filename) { if (!realFilepath) return null; return { - parser: parsers.get(ext), + parser: parsers.getByExt(ext), path: realFilepath }; }); @@ -359,6 +359,23 @@ Book.prototype.isInLanguageBook = function(filename) { }); }; +// ----- Parser Methods + +// Render a markup string in inline mode +Book.prototype.renderInline = function(type, src) { + var parser = parsers.get(type); + return parser.inline(src) + .get('content'); +}; + +// Render a markup string in block mode +Book.prototype.renderBlock = function(type, src) { + var parser = parsers.get(type); + return parser.page(src) + .get('content'); +}; + + // ----- DEPRECATED METHODS Book.prototype.contentLink = error.deprecateMethod(function(s) { |