diff --git a/bin/build.js b/bin/build.js index 6050b885f..9f3ad1dee 100644 --- a/bin/build.js +++ b/bin/build.js @@ -24,17 +24,21 @@ var buildFunc = function(dir, options) { return null; }) .then(function(repoID) { - var githubID = options.github || repoID; + var title = options.title; - if(!githubID) { - throw new Error('Needs a githubID (username/repo). Either set repo origin to a github repo or use the -g flag'); + if (!title) { + var githubID = options.github || repoID; + + if(!githubID) { + throw new Error('Needs a githubID (username/repo). Either set repo origin to a github repo or use the -g flag'); + } + + var parts = githubID.split('/', 2); + var user = parts[0], repo = parts[1]; + + title = options.title || utils.titleCase(repo); } - var parts = githubID.split('/', 2); - var user = parts[0], repo = parts[1]; - - var title = options.title || utils.titleCase(repo); - return generate.folder( _.extend(options.options || {}, { input: dir, @@ -110,4 +114,4 @@ var buildFiles = function(dir, outputFile, options, masterOptions) { module.exports = { folder: buildFunc, files: buildFiles -}; \ No newline at end of file +}; diff --git a/lib/generate/index.js b/lib/generate/index.js index 53ae5095b..480454839 100644 --- a/lib/generate/index.js +++ b/lib/generate/index.js @@ -39,8 +39,8 @@ var generate = function(options) { theme: path.resolve(__dirname, '../../theme') }); - if (!options.github || !options.title || !options.input || !options.output) { - return Q.reject(new Error("Need options: github, title, input, output")); + if (!options.title || !options.input || !options.output) { + return Q.reject(new Error("Need options: title, input, output")); } if (!generators[options.generator]) { @@ -76,7 +76,7 @@ var generate = function(options) { // Generate sub-books .then(function(_langsSummary) { options.langsSummary = parse.langs(_langsSummary); - + // Generated a book for each valid entry return Q.all( _.map(options.langsSummary.list, function(entry) { @@ -84,7 +84,7 @@ var generate = function(options) { input: path.join(options.input, entry.path), output: path.join(options.output, entry.path) })); - }) + }) ); }) diff --git a/lib/generate/site/index.js b/lib/generate/site/index.js index 1cd63ff9c..357db9307 100644 --- a/lib/generate/site/index.js +++ b/lib/generate/site/index.js @@ -47,7 +47,7 @@ Generator.prototype._writeTemplate = function(tpl, options, output) { title: that.options.title, description: that.options.description, - githubAuthor: that.options.github.split("/")[0], + githubAuthor: that.options.github ? that.options.github.split("/")[0] : "", githubId: that.options.github, githubHost: that.options.githubHost, @@ -151,4 +151,4 @@ Generator.prototype.finish = function() { .then(this.writeSearchIndex); }; -module.exports = Generator; \ No newline at end of file +module.exports = Generator; diff --git a/theme/templates/includes/book/header.html b/theme/templates/includes/book/header.html index 7732b37d7..5662714e5 100644 --- a/theme/templates/includes/book/header.html +++ b/theme/templates/includes/book/header.html @@ -1,6 +1,8 @@