summaryrefslogtreecommitdiffstats
path: root/lib/book.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-01-29 14:09:27 +0100
committerSamy Pessé <samypesse@gmail.com>2015-01-29 14:09:27 +0100
commit2bec7c5e10274b260faea3e007b056c19760cc6e (patch)
tree7c16616115430b151093e634afe3e66b8341ffe1 /lib/book.js
parent907ce6dbcdbebd59f4ce5a43073b0dd68056d6c2 (diff)
downloadgitbook-2bec7c5e10274b260faea3e007b056c19760cc6e.zip
gitbook-2bec7c5e10274b260faea3e007b056c19760cc6e.tar.gz
gitbook-2bec7c5e10274b260faea3e007b056c19760cc6e.tar.bz2
Add option to block to not parse output
Diffstat (limited to 'lib/book.js')
-rw-r--r--lib/book.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/book.js b/lib/book.js
index 24ab505..5099291 100644
--- a/lib/book.js
+++ b/lib/book.js
@@ -524,9 +524,22 @@ Book.prototype.parsePage = function(filename, options) {
return filetype.parser.page(page.content);
})
+ // Post process sections
+ .then(function(_page) {
+ return _.reduce(_page.sections, function(prev, section) {
+ return prev.then(function(_sections) {
+ return that.template.postProcess(section.content || "")
+ .then(function(content) {
+ section.content = content;
+ return _sections.concat([section]);
+ })
+ });
+ }, Q([]));
+ })
+
// Prepare html
- .then(function(_page) {
- return pageUtil.normalize(_page.sections, {
+ .then(function(_sections) {
+ return pageUtil.normalize(_sections, {
book: that,
convertImages: options.convertImages,
input: filename,