diff --git a/lib/generators/site.js b/lib/generators/site.js index c8b9e91b4..a19da25f1 100644 --- a/lib/generators/site.js +++ b/lib/generators/site.js @@ -2,7 +2,11 @@ var util = require("util"); var path = require("path"); var Q = require("q"); var _ = require("lodash"); + var nunjucks = require("nunjucks"); +var ParentExtension = require("nunjucks-parent"); +var AutoEscapeExtension = require("nunjucks-autoescape"); +var FilterExtension = require("nunjucks-filter"); var fs = require("../utils/fs"); var BaseGenerator = require("../generator"); @@ -74,6 +78,11 @@ Generator.prototype.prepareTemplates = function() { } ); + // Add extension + this.env.addExtension('ParentExtension', new ParentExtension()); + this.env.addExtension('AutoEscapeExtension', new AutoEscapeExtension(this.env)); + this.env.addExtension('FilterExtension', new FilterExtension(this.env)); + return Q(); }; diff --git a/lib/template.js b/lib/template.js index e4df84cf0..27234f22a 100644 --- a/lib/template.js +++ b/lib/template.js @@ -1,7 +1,9 @@ var _ = require("lodash"); var Q = require("q"); + var nunjucks = require("nunjucks"); + var TemplateEngine = function(book) { this.book = book; @@ -22,7 +24,7 @@ TemplateEngine.prototype.renderFile = function(filename) { return that.book.statFile(filename) .then(function(stat) { var context = { - // Variabels from book.json + // Variables from book.json book: that.book.options.variables, // infos about the file diff --git a/package.json b/package.json index 1037a6ffc..488c1ea6e 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,9 @@ "gitbook-markdown": "1.0.0", "gitbook-asciidoctor": "1.0.0", "nunjucks": "git+https://github.com/SamyPesse/nunjucks.git#4019d1b7379372336b86ce1b0bf84352a2029747", + "nunjucks-parent": "0.1.0", + "unjucks-autoescape": "0.1.0", + "nunjucks-filter": "0.1.0", "semver": "2.2.1", "npmi": "0.1.1", "cheerio": "0.18.0", diff --git a/test/generation.js b/test/generation.js index d2d057430..c2c80947e 100644 --- a/test/generation.js +++ b/test/generation.js @@ -51,6 +51,7 @@ describe('Book generation', function () { it('should correctly generate a book to website', function(done) { testGeneration(book1, "site", function(output) { + console.log(fs.readdirSync(output)); assert(fs.existsSync(path.join(output, "index.html"))); }, done); }); diff --git a/theme/templates/ebook/page.html b/theme/templates/ebook/page.html index 3af7970cb..86f0df869 100644 --- a/theme/templates/ebook/page.html +++ b/theme/templates/ebook/page.html @@ -20,7 +20,7 @@
{{ section.code.solution }}
-{{ section.code.validation }}
-{% if section.code.context %}
-{{ section.code.context }}
-{% endif %}
-
-
diff --git a/theme/templates/website/includes/header.html b/theme/templates/website/includes/header.html
index ef2de6010..d3fb10e32 100644
--- a/theme/templates/website/includes/header.html
+++ b/theme/templates/website/includes/header.html
@@ -12,7 +12,7 @@