Fix generation for page format

This commit is contained in:
Samy Pessé
2014-04-06 13:43:20 -07:00
parent 2b3c67a26b
commit 65cb23feab
4 changed files with 19 additions and 30 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ function serveDir(dir, port) {
}
function logError(err) {
console.log(err.message || err);
console.log(err.stack || err.message || err);
return Q.reject(err);
};
+5 -5
View File
@@ -127,13 +127,13 @@ var generate = function(options) {
.value()
);
})
// Finish gneration
.then(function() {
return generator.finish();
});
}
})
// Finish gneration
.then(function() {
return generator.finish();
});
};
module.exports = {
+3 -21
View File
@@ -7,7 +7,7 @@ var hljs = require('highlight.js');
var fs = require("../fs");
var parse = require("../../parse");
var BaseGenerator = require("../generator");
var BaseGenerator = require("../site");
// Swig filter: highlight coloration
swig.setFilter('code', function(code, lang) {
@@ -71,30 +71,12 @@ Generator.prototype.finish = function() {
return Q()
// Generate html
.then(function(pages) {
return that.template({
title: that.options.title,
description: that.options.description,
githubAuthor: that.options.github.split("/")[0],
githubId: that.options.github,
githubHost: that.options.githubHost,
summary: that.options.summary,
allNavigation: that.options.navigation,
return that._writeTemplate(that.template, {
pages: that.pages,
basePath: basePath,
staticBase: path.join(basePath, "gitbook"),
});
})
// Write html to index.html
.then(function(html) {
return fs.writeFile(
output,
html
);
}, output);
})
// Copy assets
+10 -3
View File
@@ -87,17 +87,23 @@ Generator.prototype.convertFile = function(content, _input) {
// Generate languages index
Generator.prototype.langsIndex = function(langs) {
var that = this;
var basePath = ".";
return this._writeTemplate(this.langsTemplate, {
langs: langs.list,
basePath: basePath,
staticBase: path.join(basePath, "gitbook"),
}, path.join(this.options.output, "index.html"));
}, path.join(this.options.output, "index.html"))
.then(function() {
// Copy assets
return that.copyAssets();
});
};
// Symlink index.html and copy assets
Generator.prototype.finish = function() {
// Copy assets
Generator.prototype.copyAssets = function() {
var that = this;
return fs.copy(
@@ -105,5 +111,6 @@ Generator.prototype.finish = function() {
path.join(that.options.output, "gitbook")
);
};
Generator.prototype.finish = Generator.prototype.copyAssets;
module.exports = Generator;