Compare commits

...

3 Commits

Author SHA1 Message Date
Samy Pessé c372dfc544 Bump version to 2.4.1 2015-09-19 00:32:43 +02:00
Samy Pessé ac77200683 Fix disabling a default plugin 2015-09-19 00:31:32 +02:00
Samy Pessé f5afbc90a4 Add more tests for blocks args/kwargs 2015-09-17 11:21:55 +02:00
4 changed files with 29 additions and 10 deletions
+3
View File
@@ -2,6 +2,9 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## 2.4.1
- Fix disabling of default plugins, ex: `-highlight`
## 2.4.0
- Fix page being updated when user wants to open a link in a new tab
- Plugins can now replaced default code highlighter
+10 -8
View File
@@ -10,7 +10,7 @@ var i18n = require("./utils/i18n");
var defaultsPlugins = ["highlight"];
// Normalize a list of plugins to use
function normalizePluginsList(plugins) {
function normalizePluginsList(plugins, addDefaults) {
// Normalize list to an array
plugins = _.isString(plugins) ? plugins.split(",") : (plugins || []);
@@ -39,12 +39,14 @@ function normalizePluginsList(plugins) {
.value();
// Merge with defaults
plugins = _.chain(plugins)
.concat(_.map(defaultsPlugins, function(plugin) {
return { "name": plugin };
}))
.uniq()
.value();
if (addDefaults !== false) {
plugins = _.chain(plugins)
.concat(_.map(defaultsPlugins, function(plugin) {
return { "name": plugin };
}))
.uniq()
.value();
}
// Build final list
plugins = _.filter(plugins, function(plugin) {
@@ -121,7 +123,7 @@ Configuration.prototype.load = function() {
that.options.output = path.resolve(that.options.output || that.book.resolve("_book"));
that.options.plugins = normalizePluginsList(that.options.plugins);
that.options.defaultsPlugins = normalizePluginsList(that.options.defaultsPlugins || "");
that.options.defaultsPlugins = normalizePluginsList(that.options.defaultsPlugins || "", false);
that.options.plugins = _.union(that.options.plugins, that.options.defaultsPlugins);
that.options.plugins = _.uniq(that.options.plugins, "name");
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "gitbook",
"version": "2.4.0",
"version": "2.4.1",
"homepage": "https://www.gitbook.com",
"description": "Library and cmd utility to generate GitBooks",
"main": "lib/index.js",
+15 -1
View File
@@ -192,7 +192,21 @@ describe("Plugins", function () {
});
});
it("should correctly extend template blocks with arguments", function() {
it("should correctly extend template blocks with arguments (1)", function() {
return testTpl("{% test5args \"a\" %}{% endtest5args %}")
.then(function(content) {
content.should.equal("test5atest5");
});
});
it("should correctly extend template blocks with arguments (2)", function() {
return testTpl("{% test5args 'a', 'b' %}{% endtest5args %}")
.then(function(content) {
content.should.equal("test5a,btest5");
});
});
it("should correctly extend template blocks with arguments (3)", function() {
return testTpl("{% test5args 'a', 'b', 'c' %}{% endtest5args %}")
.then(function(content) {
content.should.equal("test5a,b,ctest5");