diff options
Diffstat (limited to 'lib/page/index.js')
-rw-r--r-- | lib/page/index.js | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/page/index.js b/lib/page/index.js index 8f8819c..e7a4fec 100644 --- a/lib/page/index.js +++ b/lib/page/index.js @@ -3,7 +3,6 @@ var path = require('path'); var parsers = require('gitbook-parsers'); var error = require('../utils/error'); -var Promise = require('../utils/promise'); var HTMLPipeline = require('./html'); /* @@ -99,21 +98,23 @@ Page.prototype.parse = function(opts) { // Render markup using the parser .then(function() { return that.parser.page(that.content) - .then(that.update); + .then(function(out) { + var content = _.pluck(out.sections, 'content').join('\n'); + that.update(content); + }); }) // Normalize HTML output .then(function() { - return Promise.map(that.content.sections, function(section) { - var pipeline = new HTMLPipeline(section.content, opts); - - return pipeline.output() - .then(function(content) { - return { - content: content - }; - }); - }); + var pipelineOpts = _.extend({ + onRelativeLink: function(href) { + console.log('href', href); + } + }, opts); + var pipeline = new HTMLPipeline(that.content, pipelineOpts); + + return pipeline.output() + .then(that.update); }); }; |