mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-29 05:29:02 +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.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## 2.4.1
|
||||||
|
- Fix disabling of default plugins, ex: `-highlight`
|
||||||
|
|
||||||
## 2.4.0
|
## 2.4.0
|
||||||
- Fix page being updated when user wants to open a link in a new tab
|
- Fix page being updated when user wants to open a link in a new tab
|
||||||
- Plugins can now replaced default code highlighter
|
- Plugins can now replaced default code highlighter
|
||||||
|
|||||||
+10
-8
@@ -10,7 +10,7 @@ var i18n = require("./utils/i18n");
|
|||||||
var defaultsPlugins = ["highlight"];
|
var defaultsPlugins = ["highlight"];
|
||||||
|
|
||||||
// Normalize a list of plugins to use
|
// Normalize a list of plugins to use
|
||||||
function normalizePluginsList(plugins) {
|
function normalizePluginsList(plugins, addDefaults) {
|
||||||
// Normalize list to an array
|
// Normalize list to an array
|
||||||
plugins = _.isString(plugins) ? plugins.split(",") : (plugins || []);
|
plugins = _.isString(plugins) ? plugins.split(",") : (plugins || []);
|
||||||
|
|
||||||
@@ -39,12 +39,14 @@ function normalizePluginsList(plugins) {
|
|||||||
.value();
|
.value();
|
||||||
|
|
||||||
// Merge with defaults
|
// Merge with defaults
|
||||||
plugins = _.chain(plugins)
|
if (addDefaults !== false) {
|
||||||
.concat(_.map(defaultsPlugins, function(plugin) {
|
plugins = _.chain(plugins)
|
||||||
return { "name": plugin };
|
.concat(_.map(defaultsPlugins, function(plugin) {
|
||||||
}))
|
return { "name": plugin };
|
||||||
.uniq()
|
}))
|
||||||
.value();
|
.uniq()
|
||||||
|
.value();
|
||||||
|
}
|
||||||
|
|
||||||
// Build final list
|
// Build final list
|
||||||
plugins = _.filter(plugins, function(plugin) {
|
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.output = path.resolve(that.options.output || that.book.resolve("_book"));
|
||||||
that.options.plugins = normalizePluginsList(that.options.plugins);
|
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 = _.union(that.options.plugins, that.options.defaultsPlugins);
|
||||||
that.options.plugins = _.uniq(that.options.plugins, "name");
|
that.options.plugins = _.uniq(that.options.plugins, "name");
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitbook",
|
"name": "gitbook",
|
||||||
"version": "2.4.0",
|
"version": "2.4.1",
|
||||||
"homepage": "https://www.gitbook.com",
|
"homepage": "https://www.gitbook.com",
|
||||||
"description": "Library and cmd utility to generate GitBooks",
|
"description": "Library and cmd utility to generate GitBooks",
|
||||||
"main": "lib/index.js",
|
"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 %}")
|
return testTpl("{% test5args 'a', 'b', 'c' %}{% endtest5args %}")
|
||||||
.then(function(content) {
|
.then(function(content) {
|
||||||
content.should.equal("test5a,b,ctest5");
|
content.should.equal("test5a,b,ctest5");
|
||||||
|
|||||||
Reference in New Issue
Block a user