diff options
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | lib/generate/config.js | 3 | ||||
-rw-r--r-- | lib/generate/generator.js | 20 | ||||
-rw-r--r-- | lib/generate/site/index.js | 2 | ||||
-rw-r--r-- | package.json | 2 |
5 files changed, 9 insertions, 21 deletions
@@ -74,6 +74,9 @@ Here are the options that can be stored in this file: } }, + // Variables for templating + "variables": {}, + // Links in template (null: default, false: remove, string: new value) "links": { // Custom links at top of sidebar diff --git a/lib/generate/config.js b/lib/generate/config.js index 4d814c8..7ec0741 100644 --- a/lib/generate/config.js +++ b/lib/generate/config.js @@ -38,6 +38,9 @@ var CONFIG = { } }, + // Variables for templating + "variables": {}, + // Set another theme with your own layout // It's recommended to use plugins or add more options for default theme, though // See https://github.com/GitbookIO/gitbook/issues/209 diff --git a/lib/generate/generator.js b/lib/generate/generator.js index 84c65d7..4791c98 100644 --- a/lib/generate/generator.js +++ b/lib/generate/generator.js @@ -14,9 +14,6 @@ var BaseGenerator = function(options) { this.options.plugins = Plugin.normalizeNames(this.options.plugins); this.options.plugins = _.union(this.options.plugins, this.options.defaultsPlugins); this.plugins = []; - - // Include variables (not yet loaded) - this.variables = {}; }; BaseGenerator.prototype.callHook = function(name, data) { @@ -25,22 +22,7 @@ BaseGenerator.prototype.callHook = function(name, data) { // Sets up generator BaseGenerator.prototype.load = function() { - return this.loadVariables() - .then(this.loadPlugins.bind(this)); -}; - -BaseGenerator.prototype.loadVariables = function() { - var that = this; - - return fs.readFile(path.join(this.options.input, 'variables.json'), 'utf8') - .then(function(content) { - try { - that.variables = JSON.parse(content); - } catch(err) { - console.log('No variables.json'); - } - }) - .fail(function() {}); + return this.loadPlugins(); }; BaseGenerator.prototype.loadPlugins = function() { diff --git a/lib/generate/site/index.js b/lib/generate/site/index.js index 4179917..6d86c7c 100644 --- a/lib/generate/site/index.js +++ b/lib/generate/site/index.js @@ -128,7 +128,7 @@ Generator.prototype.prepareFile = function(content, _input) { // Output directory outdir: path.dirname(_input) || '/', // Templating variables - variables: that.variables, + variables: that.options.variables, }); }) .then(function(sections) { diff --git a/package.json b/package.json index 21238b6..ee67b89 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "commander": "2.2.0", "graceful-fs": "3.0.2", "fs-extra": "0.10.0", - "highlight.js": "8.2.0", + "highlight.js": "8.3.0", "tmp": "0.0.23", "semver": "2.2.1", "gaze": "~0.5.1", |