mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-22 10:33:22 +00:00
Fix generation for page format
This commit is contained in:
+1
-1
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user