diff options
Diffstat (limited to 'lib/generators/website.js')
-rw-r--r-- | lib/generators/website.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/generators/website.js b/lib/generators/website.js index ba1d2ce..08950c8 100644 --- a/lib/generators/website.js +++ b/lib/generators/website.js @@ -123,19 +123,25 @@ Generator.prototype.finish = function() { }; // Convert an input file -Generator.prototype.writeParsedFile = function(page) { +Generator.prototype.convertFile = function(input) { var that = this; - var relativeOutput = this.book.contentLink(page.path); - var output = path.join(that.options.output, relativeOutput); + return that.book.parsePage(input, { + interpolateTemplate: function(page) { + return that.callHook("page:before", page); + }, + interpolateContent: function(page) { + return that.callHook("page", page); + } + }) + .then(function(page) { + var relativeOutput = that.book.contentLink(page.path); + var output = path.join(that.options.output, relativeOutput); - var basePath = path.relative(path.dirname(output), this.options.output) || "."; - if (process.platform === 'win32') basePath = basePath.replace(/\\/g, '/'); + var basePath = path.relative(path.dirname(output), that.options.output) || "."; + if (process.platform === 'win32') basePath = basePath.replace(/\\/g, '/'); - that.book.log.info.ln("write parsed file", page.path, "to", relativeOutput); - return that.normalizePage(page) - .then(function(_page) { - page = _page; + that.book.log.info.ln("write parsed file", page.path, "to", relativeOutput); return that._writeTemplate(that.templates["page"], { progress: page.progress, |