summaryrefslogtreecommitdiffstats
path: root/lib/page/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/page/index.js')
-rw-r--r--lib/page/index.js20
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()