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/page | |
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/page')
-rw-r--r-- | lib/page/html.js | 8 | ||||
-rw-r--r-- | lib/page/index.js | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/page/html.js b/lib/page/html.js index ea31a06..71b29b2 100644 --- a/lib/page/html.js +++ b/lib/page/html.js @@ -129,17 +129,19 @@ HTMLPipeline.prototype.transformHeadings = function() { // Outline SVG from the HML HTMLPipeline.prototype.transformSvgs = function() { + var that = this; + return this._transform('svg', function($svg) { var content = [ '<?xml version="1.0" encoding="UTF-8"?>', - renderDOM(this.$, $svg) + renderDOM(that.$, $svg) ].join('\n'); - return Promise(this.opts.onOutputSVG(content)) + return Promise(that.opts.onOutputSVG(content)) .then(function(filename) { if (!filename) return; - $svg.replaceWith(this.$('<img>').attr('src', filename)); + $svg.replaceWith(that.$('<img>').attr('src', filename)); }); }); }; diff --git a/lib/page/index.js b/lib/page/index.js index 6911ce2..51416f0 100644 --- a/lib/page/index.js +++ b/lib/page/index.js @@ -106,7 +106,7 @@ Page.prototype.read = function() { // Return templating context for this page // This is used both for themes and page parsing Page.prototype.getContext = function() { - var article = this.book.summary.find(this); + var article = this.book.summary.getArticle(this); return { file: { @@ -122,7 +122,7 @@ Page.prototype.getContext = function() { }; // Parse the page and return its content -Page.prototype.parse = function(output) { +Page.prototype.toHTML = function(output) { var that = this; this.log.debug.ln('start parsing file', this.path); @@ -137,7 +137,7 @@ Page.prototype.parse = function(output) { // Render template .then(function() { - return that.book.template.renderString(that.content, that.getContext(), { + return output.template.renderString(that.content, that.getContext(), { file: that.path }) .then(that.update); |