summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/template.js2
-rw-r--r--package.json2
-rw-r--r--test/books/basic/README.md4
-rw-r--r--test/books/highlight/README.md7
-rw-r--r--test/books/highlight/SUMMARY.md1
-rw-r--r--test/codehighlighting.js34
-rw-r--r--test/helper.js16
-rw-r--r--test/plugins.js26
8 files changed, 51 insertions, 41 deletions
diff --git a/lib/template.js b/lib/template.js
index b27be89..cc247c0 100644
--- a/lib/template.js
+++ b/lib/template.js
@@ -339,7 +339,6 @@ TemplateEngine.prototype.addBlock = function(name, block) {
// Add multiple blocks
TemplateEngine.prototype.addBlocks = function(blocks) {
- console.log('add blocks', blocks);
_.each(blocks, function(block, name) {
this.addBlock(name, block);
}, this);
@@ -351,7 +350,6 @@ TemplateEngine.prototype.applyBlock = function(name, blk) {
var func, block, func, r;
block = this.blocks[name];
- console.log('applyBlock', name, block);
if (!block) throw new Error('Block not found "'+name+'"');
if (_.isString(blk)) {
blk = {
diff --git a/package.json b/package.json
index 5480824..c3fa26b 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,7 @@
"fs-extra": "0.16.5",
"fstream-ignore": "1.0.2",
"gitbook-parsers": "0.8.2",
- "nunjucks": "mozilla/nunjucks#146a63571f1910d57cc391dfe64f3789ba1f1fd1",
+ "nunjucks": "mozilla/nunjucks#dc89bf91611a2101731c2c06afcf5c32160b4dc9",
"nunjucks-autoescape": "1.0.0",
"nunjucks-filter": "1.0.0",
"i18n": "0.5.0",
diff --git a/test/books/basic/README.md b/test/books/basic/README.md
index 73d74c0..09ade40 100644
--- a/test/books/basic/README.md
+++ b/test/books/basic/README.md
@@ -1,7 +1,3 @@
# Readme
Default description for the book.
-
-```
-test
-```
diff --git a/test/books/highlight/README.md b/test/books/highlight/README.md
new file mode 100644
index 0000000..73d74c0
--- /dev/null
+++ b/test/books/highlight/README.md
@@ -0,0 +1,7 @@
+# Readme
+
+Default description for the book.
+
+```
+test
+```
diff --git a/test/books/highlight/SUMMARY.md b/test/books/highlight/SUMMARY.md
new file mode 100644
index 0000000..ac9323c
--- /dev/null
+++ b/test/books/highlight/SUMMARY.md
@@ -0,0 +1 @@
+# Summary
diff --git a/test/codehighlighting.js b/test/codehighlighting.js
new file mode 100644
index 0000000..a64bf4b
--- /dev/null
+++ b/test/codehighlighting.js
@@ -0,0 +1,34 @@
+var _ = require('lodash');
+var should = require('should');
+var path = require('path');
+var fs = require('fs');
+
+var Plugin = require('../lib/plugin');
+var PLUGINS_ROOT = path.resolve(__dirname, 'plugins');
+
+describe('Code Highlighting', function () {
+ it('should correctly replace highlighting', function() {
+ return books.generate('highlight', 'website', {
+ prepare: function(book) {
+ var plugin = new Plugin(book, "highlight");
+ plugin.load("./highlight", PLUGINS_ROOT);
+
+ book.plugins.load(plugin);
+ }
+ })
+ .then(function(book) {
+ var PAGE = fs.readFileSync(
+ path.join(book.options.output, "index.html"),
+ { encoding: "utf-8" }
+ );
+
+ PAGE.should.be.html({
+ "code": {
+ count: 1,
+ text: 'code_test\n_code'
+ }
+ });
+ });
+ });
+});
+
diff --git a/test/helper.js b/test/helper.js
index ef5c45c..f4432a9 100644
--- a/test/helper.js
+++ b/test/helper.js
@@ -17,18 +17,18 @@ var TMPDIR = os.tmpdir();
// Generate and return a book
-function generateBook(bookId, test, options) {
- options = _.defaults(options || {}, {
- before: function() {}
+function generateBook(bookId, test, opts) {
+ opts = _.defaults(opts || {}, {
+ prepare: function() {}
});
return parseBook(bookId, test)
.then(function(book) {
- return Q(options.before(book))
- .thenResolve(book);
- })
- .then(function(book) {
- return book.generate(test)
+
+ return Q(opts.prepare(book))
+ .then(function() {
+ return book.generate(test);
+ })
.thenResolve(book);
});
}
diff --git a/test/plugins.js b/test/plugins.js
index a81110c..cc9c8e6 100644
--- a/test/plugins.js
+++ b/test/plugins.js
@@ -235,31 +235,5 @@ describe('Plugins', function () {
});
});
});
-
- describe('Replace code highlighting', function() {
- it('should correctly replace highlighting', function() {
- return books.generate('basic', 'website', {
- before: function(book) {
- var plugin = new Plugin(book, "blocks");
- plugin.load("./highlight", PLUGINS_ROOT);
-
- return book.plugins.load(plugin);
- }
- })
- .then(function() {
- var PAGE = fs.readFileSync(
- path.join(book.options.output, "index.html"),
- { encoding: "utf-8" }
- );
-
- PAGE.should.be.html({
- "code": {
- count: 1,
- text: 'code__test\n__code'
- }
- });
- });
- })
- });
});