Compare commits

...

10 Commits

Author SHA1 Message Date
Samy Pessé 0759c4dd78 Bump version to 2.0.0-alpha.4 2015-02-04 20:49:09 +01:00
Samy Pessé 82a1a151e4 Correctly copy cover for sub books 2015-02-04 20:29:49 +01:00
Samy Pessé ff6e8387fb Bump version to 2.0.0-alpha.3 2015-02-04 18:31:26 +01:00
Samy Pessé f71601e8d3 Fix generation of multilingual books as ebook 2015-02-04 18:31:07 +01:00
Samy Pessé 234a37726f Improve logs for images and ebook copy 2015-02-04 16:54:02 +01:00
Samy Pessé 65a7979874 Load plugins from the book in priority 2015-02-04 15:25:40 +01:00
Samy Pessé 6a00bf0fc0 Remove plugin list 2015-02-04 11:54:52 +01:00
Samy Pessé 853f3d6482 Add translators on AUTHORS.md
@gbonanome, @kmelve, @AndreyAkinshin, @winniehell
2015-02-04 11:52:00 +01:00
Samy Pessé 27de7cd914 Merge pull request #582 from kmelve/version/2.0
Added Norwegian translation
2015-02-04 11:42:46 +01:00
Knut Melvær 2318cae1e6 Added Norwegian translation 2015-02-04 11:39:40 +01:00
9 changed files with 74 additions and 54 deletions
+18 -4
View File
@@ -7,12 +7,26 @@ Names below are ordered by first contribution.
Author
------
- Samy Pessé <samypesse@gmail.com>
- Aaron O'Mullan <aaron.omullan@gmail.com>
- Samy Pessé <samypesse@gmail.com> (@SamyPesse)
- Aaron O'Mullan <aaron.omullan@gmail.com> (@AaronO)
Contributors
------------
- Nijiko Yonskai
- Herman Starikov
- Nijiko Yonskai (@Nijikokun)
- Herman Starikov (@Hermanya)
Translators
------------
- German
- Winnie (@winniehell)
- Italian
- Giulio Bonanome (@gbonanome)
- Russian
- Andrey Akinshin (@AndreyAkinshin)
- Norwegian
- Knut Melvær (@kmelve)
- French
- Samy Pessé (@SamyPesse)
+1 -29
View File
@@ -199,36 +199,8 @@ The platform [GitBook.com](https://www.gitbook.com/) is like an "Heroku for book
Plugins can be used to extend your book's functionality. Read [GitbookIO/plugin](https://github.com/GitbookIO/plugin) for more information about how to build a plugin for GitBook.
Plugins needed to build a book can be installed using: `gitbook install ./`.
Plugins needed to build a book can be installed using: `gitbook install ./`. You can find plugins at [plugins.gitbook.com](plugins.gitbook.com).
##### Official plugins:
| Name | Description |
| ----- | ---- |
| [exercises](https://github.com/GitbookIO/plugin-exercises) | Add interactive exercises to your book. |
| [quizzes](https://github.com/GitbookIO/plugin-quizzes) | Add interactive quizzes to your book. |
| [mathjax](https://github.com/GitbookIO/plugin-mathjax) | Displays mathematical notation in the book. |
| [mixpanel](https://github.com/GitbookIO/plugin-mixpanel) | Mixpanel tracking for your book |
| [infinitescroll](https://github.com/GitbookIO/gitbook-plugin-infinitescroll) | Infinite Scrolling |
##### Other plugins:
| Name | Description |
| ----- | ---- |
| [Google Analytics](https://github.com/GitbookIO/plugin-ga) | Google Analytics tracking for your book |
| [Disqus](https://github.com/GitbookIO/plugin-disqus) | Disqus comments integration in your book |
| [Autocover](https://github.com/GitbookIO/plugin-autocover) | Generate a cover for your book |
| [Transform annoted quotes to notes](https://github.com/erixtekila/gitbook-plugin-richquotes) | Allow extra markdown markup to render blockquotes as nice notes |
| [Send code to console](https://github.com/erixtekila/gitbook-plugin-toconsole) | Evaluate javascript block in the browser inspector's console |
| [Revealable sections](https://github.com/mrpotes/gitbook-plugin-reveal) | Reveal sections of the page using buttons made from the first title in each section |
| [Markdown within HTML](https://github.com/mrpotes/gitbook-plugin-nestedmd) | Process markdown within HTML blocks - allows custom layout options for individual pages |
| [Bootstrap JavaScript plugins](https://github.com/mrpotes/gitbook-plugin-bootstrapjs) | Use the [Bootstrap JavaScript plugins](http://getbootstrap.com/javascript) in your online GitBook |
| [Piwik Open Analytics](https://github.com/emmanuel-keller/gitbook-plugin-piwik) | Piwik Open Analytics tracking for your book |
| [Heading Anchors](https://github.com/rlmv/gitbook-plugin-anchors) | Add linkable Github-style anchors to headings |
| [JSBin](https://github.com/jcouyang/gitbook-plugin-jsbin) | Embedded jsbin frame into your book |
| [GrVis](https://github.com/romanlytkin/gitbook-grvis) | Gitbook GrViz plugin is used to select from markdown dot and converting it into a picture format svg |
| [PlantUml](https://github.com/romanlytkin/gitbook-plantuml) | Gitbook PlantUml plugin is used to select from markdown uml and converting it into a picture format svg |
| [Mermaid](https://github.com/JozoVilcek/gitbook-plugin-mermaid) | Adds diagrams and flowcharts rendered by [mermaid](https://github.com/knsv/mermaid) |
## Debugging
+25 -14
View File
@@ -117,7 +117,7 @@ Book.prototype.parse = function() {
path.join(that.root, lang.path),
_.merge({}, that.context, {
config: _.extend({}, that.options, {
'output': path.join(that.options.output, lang.path),
'output': path.join(that.options.output, lang.lang),
'language': lang.lang
})
}),
@@ -185,8 +185,6 @@ Book.prototype.generate = function(generator) {
return generator.prepare();
})
// Generate content
.then(function() {
if (that.isMultilingual()) {
@@ -280,9 +278,7 @@ Book.prototype.generateFile = function(output, options) {
return fs.tmp.dir()
.then(function(tmpDir) {
book.config.extend({
output: tmpDir
});
book.setOutput(tmpDir);
return book.generate(options.ebookFormat)
.then(function(_options) {
@@ -295,14 +291,11 @@ Book.prototype.generateFile = function(output, options) {
_tmpDir = path.join(_tmpDir, lang);
}
book.log.info("copy ebook to", output, "...");
book.log.debug.ln("copy ebook to", _outputFile);
return fs.copy(
path.join(_tmpDir, "index."+options.ebookFormat),
_outputFile
)
.then(function() {
book.log.info.ok();
});
);
};
// Multi-langs book
@@ -313,12 +306,15 @@ Book.prototype.generateFile = function(output, options) {
_.map(book.langs, function(lang) {
return copyFile(lang.lang);
})
);
)
.thenResolve(book.langs.length);
} else {
return copyFile();
return copyFile().thenResolve(1);
}
})
.then(function() {
.then(function(n) {
book.log.info.ok(n+" file(s) generated");
return fs.remove(tmpDir);
});
});
@@ -650,6 +646,11 @@ Book.prototype.parentRoot = function() {
return this.root;
};
// Return true if it's a sub-book
Book.prototype.isSubBook = function() {
return !!this.parent;
};
// Resolve a path in book
Book.prototype.resolve = function(p) {
return path.resolve(this.root, p);
@@ -692,6 +693,16 @@ Book.prototype._defaultsStructure = function(filename) {
that.langsFile = that.langsFile || that.config.getStructure("langs")+extension;
}
// Change output path
Book.prototype.setOutput = function(p) {
var that = this;
this.options.output = path.resolve(p);
_.each(this.books, function(book) {
book.setOutput(path.join(that.options.output, book.options.language));
});
};
// Init and return a book
Book.init = function(root) {
+2
View File
@@ -107,6 +107,8 @@ Configuration.prototype.load = function() {
if (that.options.gitbook == "*") {
that.book.log.warn.ln("you should specify a gitbook version to use in your book.json, for example: "+(_.first(pkg.version.split("."))+".x.x"));
}
that.options.gitbook = pkg.version;
});
};
+1 -1
View File
@@ -58,7 +58,7 @@ BaseGenerator.prototype.copyCover = function() {
])
.fail(function() {
// If orignaly from multi-lang, try copy from parent
if (!that.isMultilingual()) return;
if (!that.book.isSubBook()) return;
return Q.all([
fs.copy(path.join(that.book.parentRoot(), "cover.jpg"), path.join(that.options.output, "cover.jpg")),
+4 -1
View File
@@ -22,8 +22,11 @@ var Plugin = function(book, name) {
"gitbook-"+name,
name,
], function(_name) {
if (this.load(_name, __dirname)) return false;
// Load from the book
if (this.load(_name, book.root)) return false;
// Load from default plugins
if (this.load(_name, __dirname)) return false;
}, this);
};
+4 -4
View File
@@ -218,7 +218,7 @@ function normalizeHtml(src, options) {
function convertImages(images, options) {
if (!options.convertImages) return Q();
options.book.log.info.ln("convert ", images.length, "images to png");
options.book.log.debug.ln("convert ", images.length, "images to png");
return _.reduce(images, function(prev, image) {
var imgin = path.resolve(options.book.options.output, image.source);
@@ -228,8 +228,8 @@ function convertImages(images, options) {
// Write image if need to be download
.then(function() {
if (!image.origin) return;
options.book.log.info("download image", image.origin);
return options.book.log.info.promise(fs.writeStream(imgin, request(image.origin)));
options.book.log.debug("download image", image.origin, "...");
return options.book.log.debug.promise(fs.writeStream(imgin, request(image.origin)));
})
// Write svg if content
@@ -247,7 +247,7 @@ function convertImages(images, options) {
});
}, Q())
.then(function() {
options.book.log.info.ok(images.length+" images converted with success");
options.book.log.debug.ok(images.length+" images converted with success");
});
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "gitbook",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.4",
"homepage": "https://www.gitbook.com",
"description": "Library and cmd utility to generate GitBooks",
"main": "lib/index.js",
+18
View File
@@ -0,0 +1,18 @@
{
"LANGS_CHOOSE": "Velg språk",
"GLOSSARY": "Register",
"GLOSSARY_INDEX": "Indeks",
"GLOSSARY_OPEN": "Register",
"GITBOOK_LINK": "Publisert med GitBook",
"SUMMARY": "Innholdsfortegnelse",
"SUMMARY_INTRODUCTION": "Innledning",
"SUMMARY_TOGGLE": "Innholdsfortegnelse",
"SEARCH_TOGGLE": "Søk",
"SEARCH_PLACEHOLDER": "Skriv inn søkeord",
"FONTSETTINGS_TOGGLE": "Tekstinnstillinger",
"SHARE_TOGGLE": "Del",
"SHARE_ON": "Del på __platform__",
"FONTSETTINGS_WHITE": "Lys",
"FONTSETTINGS_SEPIA": "Sepia",
"FONTSETTINGS_NIGHT": "Mørk"
}