summaryrefslogtreecommitdiffstats
path: root/lib/parse/parseConfig.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-05-12 11:15:13 +0200
committerSamy Pessé <samypesse@gmail.com>2016-05-12 11:15:13 +0200
commit8aa2f3075c81161746cd63a388ce0eddc536ac15 (patch)
treea33ac0df67023a69b985b650e3b33af7e12ae117 /lib/parse/parseConfig.js
parent839ee0385af2e6a9917826b07dd61c851244e6e0 (diff)
downloadgitbook-8aa2f3075c81161746cd63a388ce0eddc536ac15.zip
gitbook-8aa2f3075c81161746cd63a388ce0eddc536ac15.tar.gz
gitbook-8aa2f3075c81161746cd63a388ce0eddc536ac15.tar.bz2
Fix #1294: multilingual book should extend the book's config
Diffstat (limited to 'lib/parse/parseConfig.js')
-rw-r--r--lib/parse/parseConfig.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/parse/parseConfig.js b/lib/parse/parseConfig.js
index 5200de2..39d57f0 100644
--- a/lib/parse/parseConfig.js
+++ b/lib/parse/parseConfig.js
@@ -1,7 +1,5 @@
var Promise = require('../utils/promise');
-var Config = require('../models/config');
-var File = require('../models/file');
var validateConfig = require('./validateConfig');
var CONFIG_FILES = require('../constants/configFiles');
@@ -13,6 +11,7 @@ var CONFIG_FILES = require('../constants/configFiles');
*/
function parseConfig(book) {
var fs = book.getFS();
+ var config = book.getConfig();
return Promise.some(CONFIG_FILES, function(filename) {
// Is this file ignored?
@@ -38,13 +37,18 @@ function parseConfig(book) {
})
.then(function(result) {
- var file = result? result.file : File();
var values = result? result.values : {};
-
values = validateConfig(values);
- var config = Config.create(file, values);
- return book.set('config', config);
+ // Set the file
+ if (result.file) {
+ config = config.setFile(result.file);
+ }
+
+ // Merge with old values
+ config = config.mergeValues(values);
+
+ return book.setConfig(config);
});
}