Compare commits

...

3 Commits

Author SHA1 Message Date
Samy Pessé cee1d90fc6 Bump version to 0.5.2 2014-06-08 01:09:51 +02:00
Samy Pessé 522342667c Fix font size for mono font on pdf output 2014-06-08 00:27:18 +02:00
Samy Pessé d1c1277bb9 Fix cover picture for multilangs book convertion to ebook 2014-06-08 00:11:50 +02:00
6 changed files with 36 additions and 4 deletions
+1
View File
@@ -61,6 +61,7 @@ Generator.prototype.finish = function() {
"--margin-bottom": String(pdfOptions.margin.bottom),
"--pdf-add-toc": Boolean(pdfOptions.toc),
"--pdf-default-font-size": String(pdfOptions.fontSize),
"--pdf-mono-font-size": String(pdfOptions.fontSize),
"--paper-size": String(pdfOptions.paperSize),
"--pdf-page-numbers": Boolean(pdfOptions.pageNumbers)
});
+22
View File
@@ -45,6 +45,28 @@ BaseGenerator.prototype.transferFolder = function(input) {
);
};
BaseGenerator.prototype.copyCover = function() {
var that = this;
return Q.all([
fs.copy(path.join(this.options.input, "cover.jpg"), path.join(this.options.output, "cover.jpg")),
fs.copy(path.join(this.options.input, "cover_small.jpg"), path.join(this.options.output, "cover_small.jpg"))
])
.fail(function() {
// If orignally from multi-lang, try copy from originalInput
if (!that.options.originalInput) return;
return Q.all([
fs.copy(path.join(that.options.originalInput, "cover.jpg"), path.join(that.options.output, "cover.jpg")),
fs.copy(path.join(that.options.originalInput, "cover_small.jpg"), path.join(that.options.output, "cover_small.jpg"))
]);
})
.fail(function(err) {
console.log(err);
return Q();
});
};
BaseGenerator.prototype.langsIndex = function(langs) {
return Q.reject(new Error("Langs index is not supported in this generator"));
};
+3 -1
View File
@@ -161,7 +161,9 @@ var generateMultiLang = function(options) {
return prev.then(function() {
return generate(_.extend({}, options, {
input: path.join(options.input, entry.path),
output: path.join(options.output, entry.path)
output: path.join(options.output, entry.path),
originalInput: options.input,
originalOutput: options.output
}));
})
}, Q());
+5
View File
@@ -75,6 +75,11 @@ Generator.prototype.finish = function() {
}, output);
})
// Copy cover
.then(function() {
return that.copyCover();
})
// Copy assets
.then(function() {
return fs.copy(
+4 -2
View File
@@ -188,7 +188,7 @@ Generator.prototype.copyAssets = function() {
path.join(that.options.output, "gitbook")
)
// Add to cach manifest
// Add to cache manifest
.then(function() {
return that.manifest.addFolder(path.join(that.options.output, "gitbook"), "gitbook");
})
@@ -227,7 +227,9 @@ Generator.prototype.writeCacheManifest = function() {
};
Generator.prototype.finish = function() {
var deferred = this.copyAssets().then(this.writeSearchIndex);
var deferred = this.copyAssets()
.then(this.copyCover)
.then(this.writeSearchIndex);
if (this.options.cache !== false) {
deferred = deferred.then(this.writeCacheManifest);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "gitbook",
"version": "0.5.1",
"version": "0.5.2",
"homepage": "http://www.gitbook.io/",
"description": "Library and cmd utility to generate GitBooks",
"main": "lib/index.js",