diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-02-12 21:25:43 +0100 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-02-12 21:25:43 +0100 |
commit | 0d966fe19738089607de3927694ac5f2bd41f03f (patch) | |
tree | 92d4d3711459249e48dfc708870afff42367a3fc /lib/page/index.js | |
parent | 82f94b010f1d77957c9d1b0967dcdd5eafe73c39 (diff) | |
download | gitbook-0d966fe19738089607de3927694ac5f2bd41f03f.zip gitbook-0d966fe19738089607de3927694ac5f2bd41f03f.tar.gz gitbook-0d966fe19738089607de3927694ac5f2bd41f03f.tar.bz2 |
Separate output in FolderOutput and base
Diffstat (limited to 'lib/page/index.js')
-rw-r--r-- | lib/page/index.js | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/lib/page/index.js b/lib/page/index.js index 7074780..8d1bfed 100644 --- a/lib/page/index.js +++ b/lib/page/index.js @@ -80,14 +80,9 @@ Page.prototype.read = function() { }; // Parse the page and return its content -Page.prototype.parse = function(opts) { +Page.prototype.parse = function(output) { var that = this; - opts = _.defaults(opts || {}, { - linkPages: true - }); - - this.log.debug.ln('start parsing file', this.path); return this.read() @@ -122,17 +117,10 @@ Page.prototype.parse = function(opts) { // Normalize HTML output .then(function() { - var pipelineOpts = _.extend({ + var pipelineOpts = { // Replace links to page of summary - onRelativeLink: function(href) { - if (!opts.linkPages) return href; - - var to = that.book.getPage(href); - if (to) return to.outputPath(); - - return href; - } - }, opts); + onRelativeLink: _.partial(output.onRelativeLink, that) + }; var pipeline = new HTMLPipeline(that.content, pipelineOpts); return pipeline.output() |