mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-27 12:39:08 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c372dfc544 | |||
| ac77200683 | |||
| f5afbc90a4 |
@@ -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
@@ -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
@@ -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
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user