diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-14 22:49:55 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-14 22:49:55 +0100 |
commit | fef822145d43d80dbbefa8712eab88ad7044d6c1 (patch) | |
tree | 611af2ef4292e9e9a918c2840db2a65b7efdd587 /lib/output/base.js | |
parent | cfefa7d57992738373649dab16cbaf4754c3e5c7 (diff) | |
download | gitbook-fef822145d43d80dbbefa8712eab88ad7044d6c1.zip gitbook-fef822145d43d80dbbefa8712eab88ad7044d6c1.tar.gz gitbook-fef822145d43d80dbbefa8712eab88ad7044d6c1.tar.bz2 |
Move conrefs to a separate mixin
Diffstat (limited to 'lib/output/base.js')
-rw-r--r-- | lib/output/base.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/output/base.js b/lib/output/base.js index 8142761..fede3da 100644 --- a/lib/output/base.js +++ b/lib/output/base.js @@ -1,5 +1,6 @@ var _ = require('lodash'); var Ignore = require('ignore'); +var path = require('path'); var Promise = require('../utils/promise'); var PluginsManager = require('../plugins'); @@ -107,7 +108,7 @@ Output.prototype.prepare = function() { // Write a page (parsable file), ex: markdown, etc Output.prototype.onPage = function(page) { - return page.parse(this); + return page.toHTML(this); }; // Copy an asset file (non-parsable), ex: images, etc @@ -134,9 +135,14 @@ Output.prototype.onOutputImage = function(page, imgFile) { return page.relative(imgFile); }; -// By default don;t resolve conrefs -Output.prototype.onResolveTemplate = function(from, to) { +// Read a template by its source URL +Output.prototype.onGetTemplate = function(sourceUrl) { + throw new Error('template not found '+sourceUrl); +}; +// Generate a source URL for a template +Output.prototype.onResolveTemplate = function(from, to) { + return path.resolve(path.dirname(from), to); }; // Finish the generation |