mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-28 04:58:52 +00:00
Compare commits
124 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e7f2803d11 | |||
| 320015dd8f | |||
| 471c124a98 | |||
| aa44a109c6 | |||
| 41e5ca8422 | |||
| 53af8b2bb6 | |||
| bd885b135f | |||
| 62a6dde81a | |||
| 14b72b344f | |||
| ac03668063 | |||
| 2512e176c9 | |||
| b613393866 | |||
| 607a6e95de | |||
| 871f574ff7 | |||
| 377e470b15 | |||
| e0a3f0cea5 | |||
| 66727b2736 | |||
| 8215ad977f | |||
| a611dffbdf | |||
| 39f378d8cf | |||
| f00da58153 | |||
| 09b038b16d | |||
| cf601d97ad | |||
| 80edad53d4 | |||
| a972b32769 | |||
| efcaae3e60 | |||
| e0ee591638 | |||
| 310a6d909f | |||
| cefd8fc50f | |||
| a4422593f2 | |||
| e2c5d22756 | |||
| 84385d9dc3 | |||
| 6cfa4c8ab7 | |||
| c76ccc53e1 | |||
| d48eafb1a2 | |||
| 302d9b4b91 | |||
| a091a7f68b | |||
| 53621f6de3 | |||
| 288b965db3 | |||
| 578c9dcfc6 | |||
| 64de17b248 | |||
| 501843d624 | |||
| 508ce4283e | |||
| 4aa8e66549 | |||
| 917a6f70d8 | |||
| 2f5e53da55 | |||
| c3cdefc90a | |||
| 9c580e4989 | |||
| 50c902c4e4 | |||
| 84b6e0bde6 | |||
| abc29c3fba | |||
| 8356c534f5 | |||
| 78ff2687b4 | |||
| 9b6586fb36 | |||
| ea133219d0 | |||
| c9b5d81a3c | |||
| d895c63211 | |||
| 8c86da67ca | |||
| a9a230dfc3 | |||
| 6d53e52771 | |||
| 52e10b7cfe | |||
| addac85696 | |||
| 13fb949d68 | |||
| f1b593cfbd | |||
| f998e2dec9 | |||
| 2c0bd53a91 | |||
| 6dd7f6162f | |||
| 475b0bb2b3 | |||
| e6343935e3 | |||
| 946883fd4c | |||
| b1b7e3148b | |||
| 32203f6438 | |||
| f2d3c5d2ed | |||
| 7e2f0ed4bc | |||
| a877acf905 | |||
| ac756ddf7e | |||
| 36e2236e6b | |||
| 72df665520 | |||
| 07785528a5 | |||
| bb579dd581 | |||
| a7d3064340 | |||
| 1a60778248 | |||
| cda4bb5bda | |||
| 7543781046 | |||
| 82f3ffad06 | |||
| dc4d2a1731 | |||
| 2523925915 | |||
| d5bbd8475c | |||
| 54d195268a | |||
| a0deb9509f | |||
| b0b1433594 | |||
| 17a2c0a37c | |||
| fd68ea1cc2 | |||
| 784874c776 | |||
| f45c6d3466 | |||
| 98af70902f | |||
| 41a67b5c4c | |||
| 83ee903af4 | |||
| e591b0e485 | |||
| bcc9a34742 | |||
| 6b56c7de7f | |||
| 7b42719699 | |||
| 64b8343f67 | |||
| fcc5089fa6 | |||
| 334f782aa8 | |||
| 1776f2bf77 | |||
| e259412f79 | |||
| 999a02f110 | |||
| 604d0fba65 | |||
| 0e8f7b870b | |||
| 1eebc9a46e | |||
| 0a94c80c44 | |||
| c70bb2fbd8 | |||
| 12c06b384f | |||
| 82a58e7ac3 | |||
| dcb56ef433 | |||
| 8da91de514 | |||
| 4b20685562 | |||
| fff7c5cc3a | |||
| 3065742b73 | |||
| ffd69ad1f2 | |||
| 9004011479 | |||
| 1046bb4133 | |||
| 5578505213 |
+25
-10
@@ -21,22 +21,37 @@ Translators
|
|||||||
------------
|
------------
|
||||||
|
|
||||||
- German
|
- German
|
||||||
- Winnie (@winniehell)
|
- Winnie (@winniehell)
|
||||||
- Italian
|
- Italian
|
||||||
- Giulio Bonanome (@gbonanome)
|
- Giulio Bonanome (@gbonanome)
|
||||||
- Russian
|
- Russian
|
||||||
- Andrey Akinshin (@AndreyAkinshin)
|
- Andrey Akinshin (@AndreyAkinshin)
|
||||||
- Norwegian
|
- Norwegian
|
||||||
- Knut Melvær (@kmelve)
|
- Knut Melvær (@kmelve)
|
||||||
- Persian (Farsi)
|
- Persian (Farsi)
|
||||||
- Mohammad Hossein Mojtahedi (@mhm5000)
|
- Mohammad Hossein Mojtahedi (@mhm5000)
|
||||||
|
- Polish
|
||||||
|
- Łukasz Szeremeta (@lszeremeta)
|
||||||
- Portuguese
|
- Portuguese
|
||||||
- Ryan O'Mullan (@RyanOM)
|
- Ryan O'Mullan (@RyanOM)
|
||||||
- Spanish
|
- Spanish
|
||||||
- Ryan O'Mullan (@RyanOM)
|
- Ryan O'Mullan (@RyanOM)
|
||||||
- Simplifiled Chinese
|
- Simplifiled Chinese
|
||||||
- Hu Hao (@howiehu)
|
- Hu Hao (@howiehu)
|
||||||
- Traditional Chinese
|
- Traditional Chinese
|
||||||
- Hu Hao (@howiehu)
|
- Hu Hao (@howiehu)
|
||||||
- French
|
- French
|
||||||
- Samy Pessé (@SamyPesse)
|
- Samy Pessé (@SamyPesse)
|
||||||
|
- Romanian
|
||||||
|
- Iancu Aurel (@awrelll)
|
||||||
|
- Finnish
|
||||||
|
- Tommi Savikko (@savikko)
|
||||||
|
- Japanese
|
||||||
|
- Iancu Aurel (@awrelll)
|
||||||
|
- Korean
|
||||||
|
- Iancu Aurel (@awrelll)
|
||||||
|
- SangYeob Yu (@deminoth)
|
||||||
|
- Vietnamese
|
||||||
|
- Hong Nguyen (@nghong)
|
||||||
|
- Hebrew
|
||||||
|
- @a-moses
|
||||||
|
|||||||
+62
@@ -2,6 +2,68 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## 2.3.2
|
||||||
|
- Fix blocks (like maths) in Asciidoc
|
||||||
|
- Fix error when checking gitbook version
|
||||||
|
|
||||||
|
## 2.3.1
|
||||||
|
- Fix black font color for ebooks (mobi, pdf and epub)
|
||||||
|
- Fix ISO code for korean language
|
||||||
|
- Fix korean translation
|
||||||
|
- Fix syntax highlighting for asciidoc
|
||||||
|
- Fix inline html escaping in markdown
|
||||||
|
- Add warning for file outside SUMMARY
|
||||||
|
- Force SUMMARY entries to be unique by filename
|
||||||
|
|
||||||
|
## 2.3.0
|
||||||
|
- Fix nunjucks issue with multiple `{% raw %}` blocks
|
||||||
|
- Fix crash when git conref failed
|
||||||
|
- Fix crash when failed to download remote image (better error message)
|
||||||
|
- Fix flicking effect when changing page (big UX improvement)
|
||||||
|
- Add Hebrew translation (`he`)
|
||||||
|
- Add utility method `book.config.get` for plugins
|
||||||
|
- Hooks `page:before` and `page` are no longer deprecated
|
||||||
|
- Remove webfonts to make website lighter
|
||||||
|
- Make glossary's order case insensitive
|
||||||
|
|
||||||
|
## 2.2.0
|
||||||
|
- Fix direction in code blocks (always LTR)
|
||||||
|
- Add options `chapterMark` and `pageBreaksBefore` for PDF
|
||||||
|
- Update code highlighting library
|
||||||
|
- `book.json` accessible as `config` in templating syntax
|
||||||
|
- Add Vietnamese translation (`vi`)
|
||||||
|
|
||||||
|
## 2.1.0
|
||||||
|
- Fix error in calcul of `levels` in table of contents, error introduced a few versions ago
|
||||||
|
- Add optional `styles/print.css` to replace `print.css` used in ebook
|
||||||
|
|
||||||
|
## 2.0.4
|
||||||
|
- Fix `{% raw %}`, got confused with "fake" variable declarations
|
||||||
|
- Fix title of language chooser
|
||||||
|
- Fix the X-UA-Compatible meta tag
|
||||||
|
- Move style sheets to the <head> section
|
||||||
|
|
||||||
|
## 2.0.3
|
||||||
|
- Fix `gitbook init` for SUMMARY with empty entries
|
||||||
|
- Fix escaping of code blocks in markdown
|
||||||
|
|
||||||
|
## 2.0.2
|
||||||
|
- Fix relative links in windows
|
||||||
|
- Improve watcher in serve command (switch to chokidar)
|
||||||
|
- Add Romanian translation (`ro`)
|
||||||
|
- Add Finish translation (`fi`)
|
||||||
|
- Add Japanese translation (`jp`)
|
||||||
|
- Add Korean translation (`kr`)
|
||||||
|
|
||||||
|
## 2.0.1
|
||||||
|
- Improve error logging (display file, line and column)
|
||||||
|
- Add back support for `options.originalInput`
|
||||||
|
- Don't process math in markdown parser (delegated to `mathjax` plugin)
|
||||||
|
- Fix some cases of code blocks escaping
|
||||||
|
- Fix i18n for introduction title in json format
|
||||||
|
- Fix reload when book configuration is updated
|
||||||
|
- Fix backslashes in url when building on windows
|
||||||
|
|
||||||
## 2.0.0
|
## 2.0.0
|
||||||
- Fix page title of introduction
|
- Fix page title of introduction
|
||||||
- Ignore codeblocks when replacing glossary terms
|
- Ignore codeblocks when replacing glossary terms
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ GitBook
|
|||||||
=======
|
=======
|
||||||
|
|
||||||
[](http://badge.fury.io/js/gitbook)
|
[](http://badge.fury.io/js/gitbook)
|
||||||
[](https://travis-ci.org/GitbookIO/gitbook)
|
[](https://travis-ci.org/GitbookIO/gitbook)
|
||||||
[](https://ci.appveyor.com/project/SamyPesse/gitbook)
|
[](https://ci.appveyor.com/project/GitBook/gitbook)
|
||||||
|
|
||||||
GitBook is a command line tool (and Node.js library) for building beautiful books using GitHub/Git and Markdown (or AsciiDoc). Here is an example: [Learn Javascript](https://www.gitbook.com/book/GitBookIO/javascript).
|
GitBook is a command line tool (and Node.js library) for building beautiful books using GitHub/Git and Markdown (or AsciiDoc). Here is an example: [Learn Javascript](https://www.gitbook.com/book/GitBookIO/javascript).
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ $ gitbook build
|
|||||||
* [AsciiDoc Support](http://help.gitbook.com/format/asciidoc.html)
|
* [AsciiDoc Support](http://help.gitbook.com/format/asciidoc.html)
|
||||||
* [Variables and Templating](http://help.gitbook.com/format/templating.html)
|
* [Variables and Templating](http://help.gitbook.com/format/templating.html)
|
||||||
* [Content References](http://help.gitbook.com/format/conrefs.html)
|
* [Content References](http://help.gitbook.com/format/conrefs.html)
|
||||||
* [Plugins](http://help.gitbook.com/plugins/index.html)
|
* [Plugins](http://help.gitbook.com/format/plugins.html)
|
||||||
* Interractive reader website:
|
* Interractive reader website:
|
||||||
* Search
|
* Search
|
||||||
* Font Settings (Serif, Sans Serif)
|
* Font Settings (Serif, Sans Serif)
|
||||||
|
|||||||
+92
-23
@@ -2,9 +2,9 @@ var Q = require("q");
|
|||||||
var _ = require("lodash");
|
var _ = require("lodash");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var util = require("util");
|
var util = require("util");
|
||||||
var lunr = require('lunr');
|
var lunr = require("lunr");
|
||||||
var parsers = require("gitbook-parsers");
|
var parsers = require("gitbook-parsers");
|
||||||
var color = require('bash-color');
|
var color = require("bash-color");
|
||||||
|
|
||||||
var fs = require("./utils/fs");
|
var fs = require("./utils/fs");
|
||||||
var parseNavigation = require("./utils/navigation");
|
var parseNavigation = require("./utils/navigation");
|
||||||
@@ -12,6 +12,7 @@ var parseProgress = require("./utils/progress");
|
|||||||
var pageUtil = require("./utils/page");
|
var pageUtil = require("./utils/page");
|
||||||
var batch = require("./utils/batch");
|
var batch = require("./utils/batch");
|
||||||
var links = require("./utils/links");
|
var links = require("./utils/links");
|
||||||
|
var i18n = require("./utils/i18n");
|
||||||
var logger = require("./utils/logger");
|
var logger = require("./utils/logger");
|
||||||
|
|
||||||
var Configuration = require("./configuration");
|
var Configuration = require("./configuration");
|
||||||
@@ -114,7 +115,7 @@ Book.prototype.parse = function() {
|
|||||||
return that.parseLangs()
|
return that.parseLangs()
|
||||||
.then(function() {
|
.then(function() {
|
||||||
multilingual = that.langs.length > 0;
|
multilingual = that.langs.length > 0;
|
||||||
if (multilingual) that.log.info.ln("Parsing multilingual book, with", that.langs.length, "lanuages");
|
if (multilingual) that.log.info.ln("Parsing multilingual book, with", that.langs.length, "languages");
|
||||||
|
|
||||||
// Sub-books that inherit from the current book configuration
|
// Sub-books that inherit from the current book configuration
|
||||||
that.books = _.map(that.langs, function(lang) {
|
that.books = _.map(that.langs, function(lang) {
|
||||||
@@ -234,8 +235,15 @@ Book.prototype.generate = function(generator) {
|
|||||||
return _.reduce(ops["content"] || [], function(prev, file, i) {
|
return _.reduce(ops["content"] || [], function(prev, file, i) {
|
||||||
return prev.then(function() {
|
return prev.then(function() {
|
||||||
var p = ((i*100)/nFiles).toFixed(0)+"%";
|
var p = ((i*100)/nFiles).toFixed(0)+"%";
|
||||||
that.log.info.ln("processing", file, p);
|
that.log.debug.ln("processing", file, p);
|
||||||
return Q(generator.convertFile(file));
|
|
||||||
|
return Q(generator.convertFile(file))
|
||||||
|
.fail(function(err) {
|
||||||
|
// Transform error message to signal file
|
||||||
|
throw that.normError(err, {
|
||||||
|
fileName: file
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}, Q());
|
}, Q());
|
||||||
});
|
});
|
||||||
@@ -369,7 +377,13 @@ Book.prototype.parseReadme = function() {
|
|||||||
that.log.debug.ln("readme located at", that.readmeFile);
|
that.log.debug.ln("readme located at", that.readmeFile);
|
||||||
return that.template.renderFile(that.readmeFile)
|
return that.template.renderFile(that.readmeFile)
|
||||||
.then(function(content) {
|
.then(function(content) {
|
||||||
return readme.parser.readme(content);
|
return readme.parser.readme(content)
|
||||||
|
.fail(function(err) {
|
||||||
|
throw that.normError(err, {
|
||||||
|
name: err.name || "Readme Parse Error",
|
||||||
|
fileName: that.readmeFile
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(function(readme) {
|
.then(function(readme) {
|
||||||
@@ -396,7 +410,13 @@ Book.prototype.parseLangs = function() {
|
|||||||
that.log.debug.ln("languages index located at", that.langsFile);
|
that.log.debug.ln("languages index located at", that.langsFile);
|
||||||
return that.template.renderFile(that.langsFile)
|
return that.template.renderFile(that.langsFile)
|
||||||
.then(function(content) {
|
.then(function(content) {
|
||||||
return langs.parser.langs(content);
|
return langs.parser.langs(content)
|
||||||
|
.fail(function(err) {
|
||||||
|
throw that.normError(err, {
|
||||||
|
name: err.name || "Langs Parse Error",
|
||||||
|
fileName: that.langsFile
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(function(langs) {
|
.then(function(langs) {
|
||||||
@@ -425,8 +445,14 @@ Book.prototype.parseSummary = function() {
|
|||||||
.then(function(content) {
|
.then(function(content) {
|
||||||
return summary.parser.summary(content, {
|
return summary.parser.summary(content, {
|
||||||
entryPoint: that.readmeFile,
|
entryPoint: that.readmeFile,
|
||||||
entryPointTitle: "",
|
entryPointTitle: that.i18n('SUMMARY_INTRODUCTION'),
|
||||||
files: that.files
|
files: that.files
|
||||||
|
})
|
||||||
|
.fail(function(err) {
|
||||||
|
throw that.normError(err, {
|
||||||
|
name: err.name || "Summary Parse Error",
|
||||||
|
fileName: that.summaryFile
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -455,7 +481,13 @@ Book.prototype.parseGlossary = function() {
|
|||||||
that.log.debug.ln("glossary located at", that.glossaryFile);
|
that.log.debug.ln("glossary located at", that.glossaryFile);
|
||||||
return that.template.renderFile(that.glossaryFile)
|
return that.template.renderFile(that.glossaryFile)
|
||||||
.then(function(content) {
|
.then(function(content) {
|
||||||
return glossary.parser.glossary(content);
|
return glossary.parser.glossary(content)
|
||||||
|
.fail(function(err) {
|
||||||
|
throw that.normError(err, {
|
||||||
|
name: err.name || "Glossary Parse Error",
|
||||||
|
fileName: that.glossaryFile
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(function(glossary) {
|
.then(function(glossary) {
|
||||||
@@ -480,7 +512,7 @@ Book.prototype.parsePage = function(filename, options) {
|
|||||||
var interpolate = function(fn) {
|
var interpolate = function(fn) {
|
||||||
return Q(fn(page))
|
return Q(fn(page))
|
||||||
.then(function(_page) {
|
.then(function(_page) {
|
||||||
page = _page;
|
page = _page || page;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -675,8 +707,8 @@ Book.prototype.resolve = function(p) {
|
|||||||
return path.resolve(this.root, p);
|
return path.resolve(this.root, p);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Normalize a link to .html and convert README -> index
|
// Normalize a path to .html and convert README -> index
|
||||||
Book.prototype.contentLink = function(link) {
|
Book.prototype.contentPath = function(link) {
|
||||||
if (
|
if (
|
||||||
path.basename(link, path.extname(link)) == "README"
|
path.basename(link, path.extname(link)) == "README"
|
||||||
|| link == this.readmeFile
|
|| link == this.readmeFile
|
||||||
@@ -688,6 +720,11 @@ Book.prototype.contentLink = function(link) {
|
|||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Normalize a link to .html and convert README -> index
|
||||||
|
Book.prototype.contentLink = function(link) {
|
||||||
|
return links.normalize(this.contentPath(link));
|
||||||
|
}
|
||||||
|
|
||||||
// Index a page into the search index
|
// Index a page into the search index
|
||||||
Book.prototype.indexPage = function(page) {
|
Book.prototype.indexPage = function(page) {
|
||||||
var nav = this.navigation[page.path];
|
var nav = this.navigation[page.path];
|
||||||
@@ -722,22 +759,49 @@ Book.prototype.setOutput = function(p) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Translate a strign according to the book language
|
||||||
|
Book.prototype.i18n = function(phrase) {
|
||||||
|
var args = Array.prototype.slice.call(arguments);
|
||||||
|
return i18n.__.apply({}, [this.config.normalizeLanguage()].concat(args));
|
||||||
|
};
|
||||||
|
|
||||||
|
// Normalize error
|
||||||
|
Book.prototype.normError = function(err, opts, defs) {
|
||||||
|
if (_.isString(err)) err = new Error(err);
|
||||||
|
|
||||||
|
// Extend err
|
||||||
|
_.extend(err, opts || {});
|
||||||
|
_.defaults(err, defs || {});
|
||||||
|
|
||||||
|
err.lineNumber = err.lineNumber || err.lineno;
|
||||||
|
err.columnNumber = err.columnNumber || err.colno;
|
||||||
|
|
||||||
|
err.toString = function() {
|
||||||
|
var attributes = [];
|
||||||
|
|
||||||
|
if (this.fileName) attributes.push("In file '"+this.fileName+"'");
|
||||||
|
if (this.lineNumber) attributes.push("Line "+this.lineNumber);
|
||||||
|
if (this.columnNumber) attributes.push("Column "+this.columnNumber);
|
||||||
|
return (this.name || "Error")+": "+this.message+((attributes.length > 0)? " ("+attributes.join(", ")+")" : "")
|
||||||
|
};
|
||||||
|
|
||||||
|
return err;
|
||||||
|
};
|
||||||
|
|
||||||
// Init and return a book
|
// Init and return a book
|
||||||
Book.init = function(root) {
|
Book.init = function(root, opts) {
|
||||||
var book = new Book(root);
|
var book = new Book(root, opts);
|
||||||
var extensionToUse = ".md";
|
var extensionToUse = ".md";
|
||||||
|
|
||||||
var chaptersPaths = function(chapters) {
|
var chaptersPaths = function(chapters) {
|
||||||
return _.reduce(chapters || [], function(accu, chapter) {
|
return _.reduce(chapters || [], function(accu, chapter) {
|
||||||
if (!chapter.path) return accu;
|
var o = {
|
||||||
|
title: chapter.title
|
||||||
|
};
|
||||||
|
if (chapter.path) o.path = chapter.path;
|
||||||
|
|
||||||
return accu.concat(
|
return accu.concat(
|
||||||
_.filter([
|
[o].concat(chaptersPaths(chapter.articles))
|
||||||
{
|
|
||||||
title: chapter.title,
|
|
||||||
path: chapter.path
|
|
||||||
}
|
|
||||||
].concat(chaptersPaths(chapter.articles)))
|
|
||||||
);
|
);
|
||||||
}, []);
|
}, []);
|
||||||
};
|
};
|
||||||
@@ -774,12 +838,17 @@ Book.init = function(root) {
|
|||||||
.then(function(chapters) {
|
.then(function(chapters) {
|
||||||
// Create files that don't exist
|
// Create files that don't exist
|
||||||
return Q.all(_.map(chapters, function(chapter) {
|
return Q.all(_.map(chapters, function(chapter) {
|
||||||
|
if (!chapter.path) return Q();
|
||||||
var absolutePath = path.resolve(book.root, chapter.path);
|
var absolutePath = path.resolve(book.root, chapter.path);
|
||||||
|
|
||||||
return fs.exists(absolutePath)
|
return fs.exists(absolutePath)
|
||||||
.then(function(exists) {
|
.then(function(exists) {
|
||||||
book.log.info.ln("create", chapter.path);
|
if(exists) {
|
||||||
if(exists) return;
|
book.log.info.ln("found", chapter.path);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
book.log.info.ln("create", chapter.path);
|
||||||
|
}
|
||||||
|
|
||||||
return fs.mkdirp(path.dirname(absolutePath))
|
return fs.mkdirp(path.dirname(absolutePath))
|
||||||
.then(function() {
|
.then(function() {
|
||||||
|
|||||||
+40
-5
@@ -60,7 +60,6 @@ function normalizePluginsNames(plugins) {
|
|||||||
return _.pluck(normalizePluginsList(plugins), "name");
|
return _.pluck(normalizePluginsList(plugins), "name");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var Configuration = function(book, options) {
|
var Configuration = function(book, options) {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
@@ -75,6 +74,20 @@ var Configuration = function(book, options) {
|
|||||||
return that.book.root;
|
return that.book.root;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// options.originalInput == book.parent.root
|
||||||
|
Object.defineProperty(this.options, "originalInput", {
|
||||||
|
get: function () {
|
||||||
|
return that.book.parent? that.book.parent.root : undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// options.originalOutput == book.parent.options.output
|
||||||
|
Object.defineProperty(this.options, "originalOutput", {
|
||||||
|
get: function () {
|
||||||
|
return that.book.parent? that.book.parent.options.output : undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// Read and parse the configuration
|
// Read and parse the configuration
|
||||||
@@ -83,8 +96,17 @@ Configuration.prototype.load = function() {
|
|||||||
|
|
||||||
return Q()
|
return Q()
|
||||||
.then(function() {
|
.then(function() {
|
||||||
|
var configPath, config;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var _config = require(path.resolve(that.book.root, that.options.configFile));
|
configPath = require.resolve(
|
||||||
|
path.resolve(that.book.root, that.options.configFile)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Invalidate node.js cache for livreloading
|
||||||
|
delete require.cache[configPath];
|
||||||
|
|
||||||
|
_config = require(configPath);
|
||||||
that.options = _.merge(
|
that.options = _.merge(
|
||||||
that.options,
|
that.options,
|
||||||
_.omit(_config, 'configFile', 'defaultsPlugins', 'generator', 'extension')
|
_.omit(_config, 'configFile', 'defaultsPlugins', 'generator', 'extension')
|
||||||
@@ -99,8 +121,8 @@ Configuration.prototype.load = function() {
|
|||||||
if (!semver.satisfies(pkg.version, that.options.gitbook)) {
|
if (!semver.satisfies(pkg.version, that.options.gitbook)) {
|
||||||
throw "GitBook version doesn't satisfy version required by the book: "+that.options.gitbook;
|
throw "GitBook version doesn't satisfy version required by the book: "+that.options.gitbook;
|
||||||
}
|
}
|
||||||
if (that.options.gitbook == "*") {
|
if (that.options.gitbook != '*' && !semver.satisfies(semver.inc(pkg.version, 'patch'), 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.book.log.warn.ln("gitbook version specified in your book.json might be too strict for future patches, \""+(_.first(pkg.version.split("."))+".x.x")+"\" is more adequate");
|
||||||
}
|
}
|
||||||
|
|
||||||
that.options.output = path.resolve(that.options.output || path.join(that.book.root, "_book"));
|
that.options.output = path.resolve(that.options.output || path.join(that.book.root, "_book"));
|
||||||
@@ -111,7 +133,7 @@ Configuration.prototype.load = function() {
|
|||||||
|
|
||||||
// Default value for text direction (from language)
|
// Default value for text direction (from language)
|
||||||
if (!that.options.direction) {
|
if (!that.options.direction) {
|
||||||
var lang = i18n.getByLanguage(that.options.language);
|
var lang = i18n.getCatalog(that.options.language);
|
||||||
if (lang) that.options.direction = lang.direction;
|
if (lang) that.options.direction = lang.direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,6 +156,10 @@ Configuration.prototype.normalizeLanguage = function() {
|
|||||||
return i18n.normalizeLanguage(this.options.language);
|
return i18n.normalizeLanguage(this.options.language);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Return a configuration
|
||||||
|
Configuration.prototype.get = function(key, def) {
|
||||||
|
return _.get(this.options, key, def);
|
||||||
|
};
|
||||||
|
|
||||||
// Default configuration
|
// Default configuration
|
||||||
Configuration.DEFAULT = {
|
Configuration.DEFAULT = {
|
||||||
@@ -164,6 +190,7 @@ Configuration.DEFAULT = {
|
|||||||
// CSS Styles
|
// CSS Styles
|
||||||
"styles": {
|
"styles": {
|
||||||
"website": "styles/website.css",
|
"website": "styles/website.css",
|
||||||
|
"print": "styles/print.css",
|
||||||
"ebook": "styles/ebook.css",
|
"ebook": "styles/ebook.css",
|
||||||
"pdf": "styles/pdf.css",
|
"pdf": "styles/pdf.css",
|
||||||
"mobi": "styles/mobi.css",
|
"mobi": "styles/mobi.css",
|
||||||
@@ -223,6 +250,14 @@ Configuration.DEFAULT = {
|
|||||||
// Choices are [u’a0’, u’a1’, u’a2’, u’a3’, u’a4’, u’a5’, u’a6’, u’b0’, u’b1’, u’b2’, u’b3’, u’b4’, u’b5’, u’b6’, u’legal’, u’letter’]
|
// Choices are [u’a0’, u’a1’, u’a2’, u’a3’, u’a4’, u’a5’, u’a6’, u’b0’, u’b1’, u’b2’, u’b3’, u’b4’, u’b5’, u’b6’, u’legal’, u’letter’]
|
||||||
"paperSize": "a4",
|
"paperSize": "a4",
|
||||||
|
|
||||||
|
// How to mark detected chapters.
|
||||||
|
// Choices are “pagebreak”, “rule”, "both" or “none”.
|
||||||
|
"chapterMark" : "pagebreak",
|
||||||
|
|
||||||
|
// An XPath expression. Page breaks are inserted before the specified elements.
|
||||||
|
// To disable use the expression: "/"
|
||||||
|
"pageBreaksBefore": "/",
|
||||||
|
|
||||||
// Margin (in pts)
|
// Margin (in pts)
|
||||||
// Note: 72 pts equals 1 inch
|
// Note: 72 pts equals 1 inch
|
||||||
"margin": {
|
"margin": {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ var Generator = function(book, format) {
|
|||||||
this.namespace = "ebook";
|
this.namespace = "ebook";
|
||||||
|
|
||||||
// Styles to use
|
// Styles to use
|
||||||
this.styles = _.compact(["ebook", this.ebookFormat]);
|
this.styles = _.compact(["print", "ebook", this.ebookFormat]);
|
||||||
|
|
||||||
// Convert images (svg -> png)
|
// Convert images (svg -> png)
|
||||||
this.convertImages = true;
|
this.convertImages = true;
|
||||||
@@ -68,8 +68,6 @@ Generator.prototype.finish = function() {
|
|||||||
"--book-producer": "GitBook",
|
"--book-producer": "GitBook",
|
||||||
"--publisher": "GitBook",
|
"--publisher": "GitBook",
|
||||||
"--chapter": "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter ')]",
|
"--chapter": "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter ')]",
|
||||||
"--chapter-mark": "pagebreak",
|
|
||||||
"--page-breaks-before": "/",
|
|
||||||
"--level1-toc": "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-1 ')]",
|
"--level1-toc": "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-1 ')]",
|
||||||
"--level2-toc": "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-2 ')]",
|
"--level2-toc": "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-2 ')]",
|
||||||
"--level3-toc": "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-3 ')]",
|
"--level3-toc": "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-3 ')]",
|
||||||
@@ -82,6 +80,8 @@ Generator.prototype.finish = function() {
|
|||||||
var pdfOptions = that.options.pdf;
|
var pdfOptions = that.options.pdf;
|
||||||
|
|
||||||
_.extend(_options, {
|
_.extend(_options, {
|
||||||
|
"--chapter-mark": String(pdfOptions.chapterMark),
|
||||||
|
"--page-breaks-before": String(pdfOptions.pageBreaksBefore),
|
||||||
"--margin-left": String(pdfOptions.margin.left),
|
"--margin-left": String(pdfOptions.margin.left),
|
||||||
"--margin-right": String(pdfOptions.margin.right),
|
"--margin-right": String(pdfOptions.margin.right),
|
||||||
"--margin-top": String(pdfOptions.margin.top),
|
"--margin-top": String(pdfOptions.margin.top),
|
||||||
|
|||||||
+10
-13
@@ -4,9 +4,8 @@ var Q = require("q");
|
|||||||
var _ = require("lodash");
|
var _ = require("lodash");
|
||||||
|
|
||||||
var nunjucks = require("nunjucks");
|
var nunjucks = require("nunjucks");
|
||||||
var AutoEscapeExtension = require("nunjucks-autoescape");
|
var AutoEscapeExtension = require("nunjucks-autoescape")(nunjucks);
|
||||||
var FilterExtension = require("nunjucks-filter");
|
var FilterExtension = require("nunjucks-filter")(nunjucks);
|
||||||
var I18nExtension = require("nunjucks-i18n");
|
|
||||||
|
|
||||||
var fs = require("../utils/fs");
|
var fs = require("../utils/fs");
|
||||||
var BaseGenerator = require("../generator");
|
var BaseGenerator = require("../generator");
|
||||||
@@ -51,12 +50,13 @@ Generator.prototype.prepareStyles = function() {
|
|||||||
this.styles = _.chain(this.styles)
|
this.styles = _.chain(this.styles)
|
||||||
.map(function(style) {
|
.map(function(style) {
|
||||||
var stylePath = that.options.styles[style];
|
var stylePath = that.options.styles[style];
|
||||||
if (fs.existsSync(path.resolve(that.book.root, stylePath))) {
|
if (stylePath && fs.existsSync(path.resolve(that.book.root, stylePath))) {
|
||||||
return stylePath;
|
return [style, stylePath];
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
.compact()
|
.compact()
|
||||||
|
.object()
|
||||||
.value();
|
.value();
|
||||||
|
|
||||||
return Q();
|
return Q();
|
||||||
@@ -79,8 +79,8 @@ Generator.prototype.prepareTemplateEngine = function() {
|
|||||||
.then(function() {
|
.then(function() {
|
||||||
var language = that.book.config.normalizeLanguage();
|
var language = that.book.config.normalizeLanguage();
|
||||||
|
|
||||||
if (!i18n.getByLanguage(language) && language != "en") {
|
if (!i18n.hasLocale(language)) {
|
||||||
that.book.log.warn.ln("Language '"+language+"' is not available as a layout locales (en, "+i18n.getLanguages().join(", ")+")");
|
that.book.log.warn.ln("Language '"+language+"' is not available as a layout locales (en, "+i18n.getLocales().join(", ")+")");
|
||||||
}
|
}
|
||||||
|
|
||||||
var folders = _.chain(that.templates)
|
var folders = _.chain(that.templates)
|
||||||
@@ -105,11 +105,6 @@ Generator.prototype.prepareTemplateEngine = function() {
|
|||||||
// Add extension
|
// Add extension
|
||||||
that.env.addExtension('AutoEscapeExtension', new AutoEscapeExtension(that.env));
|
that.env.addExtension('AutoEscapeExtension', new AutoEscapeExtension(that.env));
|
||||||
that.env.addExtension('FilterExtension', new FilterExtension(that.env));
|
that.env.addExtension('FilterExtension', new FilterExtension(that.env));
|
||||||
that.env.addExtension('I18nExtension', new I18nExtension({
|
|
||||||
env: that.env,
|
|
||||||
translations: i18n.getLocales(),
|
|
||||||
locale: "language"
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -136,7 +131,7 @@ Generator.prototype.convertFile = function(input) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(function(page) {
|
.then(function(page) {
|
||||||
var relativeOutput = that.book.contentLink(page.path);
|
var relativeOutput = that.book.contentPath(page.path);
|
||||||
var output = path.join(that.options.output, relativeOutput);
|
var output = path.join(that.options.output, relativeOutput);
|
||||||
|
|
||||||
var basePath = path.relative(path.dirname(output), that.options.output) || ".";
|
var basePath = path.relative(path.dirname(output), that.options.output) || ".";
|
||||||
@@ -243,6 +238,8 @@ Generator.prototype._writeTemplate = function(tpl, options, output, interpolate)
|
|||||||
|
|
||||||
basePath: ".",
|
basePath: ".",
|
||||||
staticBase: path.join(".", "gitbook"),
|
staticBase: path.join(".", "gitbook"),
|
||||||
|
|
||||||
|
'__': that.book.i18n.bind(that.book)
|
||||||
}, options)
|
}, options)
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|||||||
+1
-1
@@ -158,7 +158,7 @@ module.exports = {
|
|||||||
.then(function(filepath) {
|
.then(function(filepath) {
|
||||||
// set livereload path
|
// set livereload path
|
||||||
lrPath = filepath;
|
lrPath = filepath;
|
||||||
console.log("Restart after change in files");
|
console.log("Restart after change in file", filepath);
|
||||||
console.log('');
|
console.log('');
|
||||||
return generate();
|
return generate();
|
||||||
})
|
})
|
||||||
|
|||||||
+2
-2
@@ -33,7 +33,7 @@ var Plugin = function(book, name) {
|
|||||||
// Type of plugins resources
|
// Type of plugins resources
|
||||||
Plugin.RESOURCES = ["js", "css"];
|
Plugin.RESOURCES = ["js", "css"];
|
||||||
Plugin.HOOKS = [
|
Plugin.HOOKS = [
|
||||||
"init", "finish", "finish:before"
|
"init", "finish", "finish:before", "page", "page:before"
|
||||||
]
|
]
|
||||||
|
|
||||||
// Load from a name
|
// Load from a name
|
||||||
@@ -155,7 +155,7 @@ Plugin.prototype.callHook = function(name, data) {
|
|||||||
if (!hookFunc) return Q(data);
|
if (!hookFunc) return Q(data);
|
||||||
|
|
||||||
this.book.log.debug.ln("call hook", name);
|
this.book.log.debug.ln("call hook", name);
|
||||||
if (!_.contains(Plugin.HOOKS, name)) this.book.log.warn.ln("hook '"+name+"' used by plugin '"+this.name+"' is deprecated, and will be remove in the coming versions");
|
if (!_.contains(Plugin.HOOKS, name)) this.book.log.warn.ln("hook '"+name+"' used by plugin '"+this.name+"' is deprecated, and will be removed in the coming versions");
|
||||||
|
|
||||||
return Q()
|
return Q()
|
||||||
.then(function() {
|
.then(function() {
|
||||||
|
|||||||
+18
-9
@@ -2,9 +2,9 @@ var _ = require("lodash");
|
|||||||
var Q = require("q");
|
var Q = require("q");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var nunjucks = require("nunjucks");
|
var nunjucks = require("nunjucks");
|
||||||
|
var escapeStringRegexp = require("escape-string-regexp");
|
||||||
|
|
||||||
var git = require("./utils/git");
|
var git = require("./utils/git");
|
||||||
var stringUtils = require("./utils/string");
|
|
||||||
var fs = require("./utils/fs");
|
var fs = require("./utils/fs");
|
||||||
var batch = require("./utils/batch");
|
var batch = require("./utils/batch");
|
||||||
var pkg = require("../package.json");
|
var pkg = require("../package.json");
|
||||||
@@ -103,16 +103,16 @@ TemplateEngine.prototype.processBlock = function(blk) {
|
|||||||
return blk.body;
|
return blk.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return it as a macro
|
// Return it as a position marker
|
||||||
return "%+%"+blk.id+"%+%";
|
return "@%@"+blk.id+"@%@";
|
||||||
};
|
};
|
||||||
|
|
||||||
// Replace blocks by body after processing
|
// Replace position markers of blocks by body after processing
|
||||||
// This is done to avoid that markdown processer parse the block content
|
// This is done to avoid that markdown/asciidoc processer parse the block content
|
||||||
TemplateEngine.prototype.replaceBlocks = function(content) {
|
TemplateEngine.prototype.replaceBlocks = function(content) {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
return content.replace(/\%\+\%([\s\S]+?)\%\+\%/g, function(match, key) {
|
return content.replace(/\@\%\@([\s\S]+?)\@\%\@/g, function(match, key) {
|
||||||
var blk = that.blocks[key];
|
var blk = that.blocks[key];
|
||||||
if (!blk) return match;
|
if (!blk) return match;
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ TemplateEngine.prototype.addBlock = function(name, block) {
|
|||||||
|
|
||||||
// Extract main body and kwargs
|
// Extract main body and kwargs
|
||||||
var body = args.pop();
|
var body = args.pop();
|
||||||
var kwargs = args.pop() || {};
|
var kwargs = _.isObject(_.last(args))? args.pop() : {};
|
||||||
|
|
||||||
// Extract blocks body
|
// Extract blocks body
|
||||||
var _blocks = _.map(block.blocks, function(blockName, i){
|
var _blocks = _.map(block.blocks, function(blockName, i){
|
||||||
@@ -302,7 +302,7 @@ TemplateEngine.prototype.addBlock = function(name, block) {
|
|||||||
TemplateEngine.prototype._applyShortcut = function(parser, content, shortcut) {
|
TemplateEngine.prototype._applyShortcut = function(parser, content, shortcut) {
|
||||||
if (!_.contains(shortcut.parsers, parser)) return content;
|
if (!_.contains(shortcut.parsers, parser)) return content;
|
||||||
var regex = new RegExp(
|
var regex = new RegExp(
|
||||||
stringUtils.escapeRegex(shortcut.start) + "([\\s\\S]*?[^\\$])" + stringUtils.escapeRegex(shortcut.end),
|
escapeStringRegexp(shortcut.start) + "([\\s\\S]*?[^\\$])" + escapeStringRegexp(shortcut.end),
|
||||||
'g'
|
'g'
|
||||||
);
|
);
|
||||||
return content.replace(regex, function(all, match) {
|
return content.replace(regex, function(all, match) {
|
||||||
@@ -316,6 +316,9 @@ TemplateEngine.prototype.renderString = function(content, context, options) {
|
|||||||
// Variables from book.json
|
// Variables from book.json
|
||||||
book: this.book.options.variables,
|
book: this.book.options.variables,
|
||||||
|
|
||||||
|
// Complete book.json
|
||||||
|
config: this.book.options,
|
||||||
|
|
||||||
// infos about gitbook
|
// infos about gitbook
|
||||||
gitbook: {
|
gitbook: {
|
||||||
version: pkg.version,
|
version: pkg.version,
|
||||||
@@ -331,7 +334,13 @@ TemplateEngine.prototype.renderString = function(content, context, options) {
|
|||||||
// Replace shortcuts
|
// Replace shortcuts
|
||||||
content = _.reduce(this.shortcuts, _.partial(this._applyShortcut.bind(this), options.type), content);
|
content = _.reduce(this.shortcuts, _.partial(this._applyShortcut.bind(this), options.type), content);
|
||||||
|
|
||||||
return Q.nfcall(this.env.renderString.bind(this.env), content, context, options);
|
return Q.nfcall(this.env.renderString.bind(this.env), content, context, options)
|
||||||
|
.fail(function(err) {
|
||||||
|
if (_.isString(err)) err = new Error(err);
|
||||||
|
err.message = err.message.replace(/^Error: /, "");
|
||||||
|
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// Render a file from the book
|
// Render a file from the book
|
||||||
|
|||||||
@@ -64,6 +64,10 @@ function writeStream(filename, st) {
|
|||||||
d.reject(err);
|
d.reject(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
st.on('error', function(err) {
|
||||||
|
d.reject(err);
|
||||||
|
});
|
||||||
|
|
||||||
st.pipe(wstream);
|
st.pipe(wstream);
|
||||||
|
|
||||||
return d.promise;
|
return d.promise;
|
||||||
|
|||||||
+1
-1
@@ -83,7 +83,7 @@ function cloneGitRepo(host, ref) {
|
|||||||
return exec("git clone "+host+" "+repoPath)
|
return exec("git clone "+host+" "+repoPath)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
return exec("git checkout "+ref, { cwd: repoPath });
|
return exec("git checkout "+ref, { cwd: repoPath });
|
||||||
})
|
});
|
||||||
})
|
})
|
||||||
.thenResolve(repoPath);
|
.thenResolve(repoPath);
|
||||||
});
|
});
|
||||||
|
|||||||
+40
-32
@@ -2,32 +2,20 @@ var _ = require("lodash");
|
|||||||
var path = require("path");
|
var path = require("path");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
|
|
||||||
var I18N_PATH = path.resolve(__dirname, "../../theme/i18n/")
|
var i18n = require("i18n");
|
||||||
|
|
||||||
var getLocales = _.memoize(function() {
|
var I18N_PATH = path.resolve(__dirname, "../../theme/i18n/")
|
||||||
var locales = fs.readdirSync(I18N_PATH);
|
var DEFAULT_LANGUAGE = "en";
|
||||||
return _.chain(locales)
|
var LOCALES = _.map(fs.readdirSync(I18N_PATH), function(lang) {
|
||||||
.map(function(local) {
|
return path.basename(lang, ".json");
|
||||||
local = path.basename(local, ".json");
|
|
||||||
return [local, _.extend({
|
|
||||||
direction: "ltr"
|
|
||||||
}, require(path.join(I18N_PATH, local)), {
|
|
||||||
id: local
|
|
||||||
})];
|
|
||||||
})
|
|
||||||
.object()
|
|
||||||
.value();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var getLanguages = function() {
|
i18n.configure({
|
||||||
return _.keys(getLocales());
|
locales: LOCALES,
|
||||||
};
|
directory: I18N_PATH,
|
||||||
|
defaultLocale: DEFAULT_LANGUAGE,
|
||||||
var getByLanguage = function(lang) {
|
updateFiles: false
|
||||||
lang = normalizeLanguage(lang);
|
});
|
||||||
var locales = getLocales();
|
|
||||||
return locales[lang];
|
|
||||||
};
|
|
||||||
|
|
||||||
var compareLocales = function(lang, locale) {
|
var compareLocales = function(lang, locale) {
|
||||||
var langMain = _.first(lang.split("-"));
|
var langMain = _.first(lang.split("-"));
|
||||||
@@ -43,12 +31,9 @@ var compareLocales = function(lang, locale) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var normalizeLanguage = _.memoize(function(lang) {
|
var normalizeLanguage = _.memoize(function(lang) {
|
||||||
var locales = getLocales();
|
var language = _.chain(LOCALES)
|
||||||
var language = _.chain(locales)
|
|
||||||
.values()
|
.values()
|
||||||
.map(function(locale) {
|
.map(function(locale) {
|
||||||
locale = locale.id;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
locale: locale,
|
locale: locale,
|
||||||
score: compareLocales(lang, locale)
|
score: compareLocales(lang, locale)
|
||||||
@@ -64,9 +49,32 @@ var normalizeLanguage = _.memoize(function(lang) {
|
|||||||
return language || lang;
|
return language || lang;
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = {
|
var translate = function(locale, phrase) {
|
||||||
getLocales: getLocales,
|
var args = Array.prototype.slice.call(arguments, 2);
|
||||||
getLanguages: getLanguages,
|
|
||||||
getByLanguage: getByLanguage,
|
return i18n.__.apply({}, [{
|
||||||
normalizeLanguage: normalizeLanguage
|
locale: locale,
|
||||||
|
phrase: phrase
|
||||||
|
}].concat(args));
|
||||||
|
};
|
||||||
|
|
||||||
|
var getCatalog = function(locale) {
|
||||||
|
locale = normalizeLanguage(locale);
|
||||||
|
return i18n.getCatalog(locale);
|
||||||
|
};
|
||||||
|
|
||||||
|
var getLocales = function() {
|
||||||
|
return LOCALES;
|
||||||
|
};
|
||||||
|
|
||||||
|
var hasLocale = function(locale) {
|
||||||
|
return _.contains(LOCALES, locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
__: translate,
|
||||||
|
normalizeLanguage: normalizeLanguage,
|
||||||
|
getCatalog: getCatalog,
|
||||||
|
getLocales: getLocales,
|
||||||
|
hasLocale: hasLocale
|
||||||
};
|
};
|
||||||
|
|||||||
+28
-4
@@ -13,6 +13,8 @@ var fs = require('./fs');
|
|||||||
var batch = require('./batch');
|
var batch = require('./batch');
|
||||||
var code = require('./code');
|
var code = require('./code');
|
||||||
|
|
||||||
|
var parsableExtensions = require('gitbook-parsers').extensions;
|
||||||
|
|
||||||
// Render a cheerio dom as html
|
// Render a cheerio dom as html
|
||||||
var renderDom = function($, dom, options) {
|
var renderDom = function($, dom, options) {
|
||||||
if (!dom && $._root && $._root.children) {
|
if (!dom && $._root && $._root.children) {
|
||||||
@@ -193,14 +195,22 @@ function normalizeHtml(src, options) {
|
|||||||
// Keep it as it is
|
// Keep it as it is
|
||||||
} else if (links.isRelative(href)) {
|
} else if (links.isRelative(href)) {
|
||||||
var parts = url.parse(href);
|
var parts = url.parse(href);
|
||||||
var absolutePath = path.join(options.base, parts.pathname);
|
var absolutePath = links.join(options.base, parts.pathname);
|
||||||
var anchor = parts.hash || "";
|
var anchor = parts.hash || "";
|
||||||
|
|
||||||
|
|
||||||
// If is in navigation relative: transform as content
|
// If is in navigation relative: transform as content
|
||||||
if (options.navigation[absolutePath]) {
|
if (options.navigation[absolutePath]) {
|
||||||
absolutePath = options.book.contentLink(absolutePath);
|
absolutePath = options.book.contentLink(absolutePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If md/adoc/rst files is not in summary
|
||||||
|
// or for ebook, signal all files that are outside the summary
|
||||||
|
else if (_.contains(parsableExtensions, path.extname(absolutePath))
|
||||||
|
|| _.contains(['epub', 'pdf', 'mobi'], options.book.options.generator)) {
|
||||||
|
options.book.log.warn.ln("page", options.input, "contains an hyperlink to resource outside spine '"+href+"'");
|
||||||
|
}
|
||||||
|
|
||||||
// Transform as absolute
|
// Transform as absolute
|
||||||
href = links.toAbsolute("/"+absolutePath, options.base, options.output)+anchor;
|
href = links.toAbsolute("/"+absolutePath, options.base, options.output)+anchor;
|
||||||
} else {
|
} else {
|
||||||
@@ -219,7 +229,12 @@ function normalizeHtml(src, options) {
|
|||||||
($(this).attr("class") || "").split(" ")
|
($(this).attr("class") || "").split(" ")
|
||||||
)
|
)
|
||||||
.map(function(cl) {
|
.map(function(cl) {
|
||||||
|
// Markdown
|
||||||
if (cl.search("lang-") === 0) return cl.slice("lang-".length);
|
if (cl.search("lang-") === 0) return cl.slice("lang-".length);
|
||||||
|
|
||||||
|
// Asciidoc
|
||||||
|
if (cl.search("language-") === 0) return cl.slice("language-".length);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
.compact()
|
.compact()
|
||||||
@@ -237,13 +252,16 @@ function normalizeHtml(src, options) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Replace glossary terms
|
// Replace glossary terms
|
||||||
_.each(options.glossary, function(term) {
|
var glossary = _.sortBy(options.glossary, function(term) {
|
||||||
|
return -term.name.length;
|
||||||
|
});
|
||||||
|
_.each(glossary, function(term) {
|
||||||
var r = new RegExp( "\\b(" + pregQuote(term.name.toLowerCase()) + ")\\b" , 'gi' );
|
var r = new RegExp( "\\b(" + pregQuote(term.name.toLowerCase()) + ")\\b" , 'gi' );
|
||||||
var includedInFiles = false;
|
var includedInFiles = false;
|
||||||
|
|
||||||
$("*").each(function() {
|
$("*").each(function() {
|
||||||
// Ignore codeblocks
|
// Ignore codeblocks
|
||||||
if (_.contains(["code", "pre"], this.name.toLowerCase())) return;
|
if (_.contains(["code", "pre", "a"], this.name.toLowerCase())) return;
|
||||||
|
|
||||||
replaceText($, this, r, function(match) {
|
replaceText($, this, r, function(match) {
|
||||||
// Add to files index in glossary
|
// Add to files index in glossary
|
||||||
@@ -282,7 +300,13 @@ function convertImages(images, options) {
|
|||||||
if (!image.origin && !_.contains(downloaded, image.origin)) return;
|
if (!image.origin && !_.contains(downloaded, image.origin)) return;
|
||||||
options.book.log.debug("download image", image.origin, "...");
|
options.book.log.debug("download image", image.origin, "...");
|
||||||
downloaded.push(image.origin);
|
downloaded.push(image.origin);
|
||||||
return options.book.log.debug.promise(fs.writeStream(imgin, request(image.origin)));
|
return options.book.log.debug.promise(fs.writeStream(imgin, request(image.origin)))
|
||||||
|
.fail(function(err) {
|
||||||
|
if (!_.isError(err)) err = new Error(err);
|
||||||
|
|
||||||
|
err.message = 'Fail downloading '+image.origin+': '+err.message;
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
// Write svg if content
|
// Write svg if content
|
||||||
|
|||||||
@@ -20,12 +20,7 @@ function optionsToShellArgs(options) {
|
|||||||
.join(" ");
|
.join(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeRegex(str) {
|
|
||||||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
escapeRegex: escapeRegex,
|
|
||||||
escapeShellArg: escapeShellArg,
|
escapeShellArg: escapeShellArg,
|
||||||
optionsToShellArgs: optionsToShellArgs,
|
optionsToShellArgs: optionsToShellArgs,
|
||||||
toLowerCase: String.prototype.toLowerCase.call.bind(String.prototype.toLowerCase)
|
toLowerCase: String.prototype.toLowerCase.call.bind(String.prototype.toLowerCase)
|
||||||
|
|||||||
+9
-7
@@ -1,7 +1,7 @@
|
|||||||
var Q = require('q');
|
var Q = require('q');
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var Gaze = require('gaze').Gaze;
|
var chokidar = require('chokidar');
|
||||||
|
|
||||||
var parsers = require('gitbook-parsers')
|
var parsers = require('gitbook-parsers')
|
||||||
|
|
||||||
@@ -17,17 +17,19 @@ function watch(dir) {
|
|||||||
toWatch.push("**/*"+ext);
|
toWatch.push("**/*"+ext);
|
||||||
});
|
});
|
||||||
|
|
||||||
var gaze = new Gaze(toWatch, {
|
var watcher = chokidar.watch(toWatch, {
|
||||||
cwd: dir
|
cwd: dir,
|
||||||
|
ignored: '_book/**',
|
||||||
|
ignoreInitial: true
|
||||||
});
|
});
|
||||||
|
|
||||||
gaze.once("all", function(e, filepath) {
|
watcher.once("all", function(e, filepath) {
|
||||||
gaze.close();
|
watcher.close();
|
||||||
|
|
||||||
d.resolve(filepath);
|
d.resolve(filepath);
|
||||||
});
|
});
|
||||||
gaze.once("error", function(err) {
|
watcher.once("error", function(err) {
|
||||||
gaze.close();
|
watcher.close();
|
||||||
|
|
||||||
d.reject(err);
|
d.reject(err);
|
||||||
});
|
});
|
||||||
|
|||||||
+11
-10
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitbook",
|
"name": "gitbook",
|
||||||
"version": "2.0.0",
|
"version": "2.3.2",
|
||||||
"homepage": "https://www.gitbook.com",
|
"homepage": "https://www.gitbook.com",
|
||||||
"description": "Library and cmd utility to generate GitBooks",
|
"description": "Library and cmd utility to generate GitBooks",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
@@ -12,16 +12,16 @@
|
|||||||
"resolve": "0.6.3",
|
"resolve": "0.6.3",
|
||||||
"fs-extra": "0.16.5",
|
"fs-extra": "0.16.5",
|
||||||
"fstream-ignore": "1.0.2",
|
"fstream-ignore": "1.0.2",
|
||||||
"gitbook-parsers": "0.7.2",
|
"gitbook-parsers": "0.8.1",
|
||||||
"nunjucks": "git+https://github.com/mozilla/nunjucks.git#0f8b21b8df7e8e852b2e1889388653b7075f0d09",
|
"nunjucks": "mozilla/nunjucks#b4351ec0752b102ebd02c5e2cbc2898a6e0e4839",
|
||||||
"nunjucks-autoescape": "0.1.1",
|
"nunjucks-autoescape": "1.0.0",
|
||||||
"nunjucks-filter": "0.1.0",
|
"nunjucks-filter": "1.0.0",
|
||||||
"nunjucks-i18n": "1.0.0",
|
"i18n": "0.5.0",
|
||||||
"semver": "2.2.1",
|
"semver": "5.0.1",
|
||||||
"npmi": "0.1.1",
|
"npmi": "0.1.1",
|
||||||
"cheerio": "0.19.0",
|
"cheerio": "0.19.0",
|
||||||
"gitbook-plugin-livereload": "0.0.1",
|
"gitbook-plugin-livereload": "0.0.1",
|
||||||
"gaze": "~0.5.1",
|
"chokidar": "~1.0.5",
|
||||||
"send": "0.2.0",
|
"send": "0.2.0",
|
||||||
"tiny-lr": "0.1.5",
|
"tiny-lr": "0.1.5",
|
||||||
"tmp": "0.0.24",
|
"tmp": "0.0.24",
|
||||||
@@ -32,7 +32,8 @@
|
|||||||
"npm": "2.4.1",
|
"npm": "2.4.1",
|
||||||
"dom-serializer": "0.1.0",
|
"dom-serializer": "0.1.0",
|
||||||
"spawn-cmd": "0.0.2",
|
"spawn-cmd": "0.0.2",
|
||||||
"highlight.js": "8.4.0"
|
"highlight.js": "8.8.0",
|
||||||
|
"escape-string-regexp": "1.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "2.2.1",
|
"mocha": "2.2.1",
|
||||||
@@ -60,7 +61,7 @@
|
|||||||
"gitbook"
|
"gitbook"
|
||||||
],
|
],
|
||||||
"author": "FriendCode Inc. <contact@gitbook.com>",
|
"author": "FriendCode Inc. <contact@gitbook.com>",
|
||||||
"license": "Apache 2",
|
"license": "Apache-2.0",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/GitbookIO/gitbook/issues"
|
"url": "https://github.com/GitbookIO/gitbook/issues"
|
||||||
},
|
},
|
||||||
|
|||||||
+4
-2
@@ -35,7 +35,7 @@ should.Assertion.add('html', function(rules, description) {
|
|||||||
var $el = $(query);
|
var $el = $(query);
|
||||||
|
|
||||||
// Test number of elements
|
// Test number of elements
|
||||||
$el.should.have.lengthOf(validations.count);
|
$el.length.should.be.equal(validations.count);
|
||||||
|
|
||||||
// Test text
|
// Test text
|
||||||
if (validations.text !== undefined) {
|
if (validations.text !== undefined) {
|
||||||
@@ -46,7 +46,9 @@ should.Assertion.add('html', function(rules, description) {
|
|||||||
|
|
||||||
// Test attributes
|
// Test attributes
|
||||||
_.each(validations.attributes, function(value, name) {
|
_.each(validations.attributes, function(value, name) {
|
||||||
$el.attr(name).should.be.equal(value);
|
var attr = $el.attr(name);
|
||||||
|
should(attr).be.ok;
|
||||||
|
attr.should.be.equal(value);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,3 +7,7 @@ Just a simple and easy to understand test.
|
|||||||
## hakunamatata
|
## hakunamatata
|
||||||
|
|
||||||
This word is not present in the content.
|
This word is not present in the content.
|
||||||
|
|
||||||
|
## test long
|
||||||
|
|
||||||
|
This is a test with a longer text that the first entry to test order.
|
||||||
|
|||||||
@@ -6,3 +6,5 @@ The word test should be replaced by a glossary link.
|
|||||||
But the word test should not be replaced in code blocks
|
But the word test should not be replaced in code blocks
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The two words test long should be replaced by the correct glossary links.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
*
|
||||||
|
!SUMMARY.md
|
||||||
|
!.gitignore
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# Summary
|
||||||
|
|
||||||
|
* [Hello](hello.md)
|
||||||
|
* [Hello 2](hello2.md)
|
||||||
|
* Hello 3
|
||||||
|
* [Hello 4](hello3/hello4.md)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Readme
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Summary
|
||||||
|
|
||||||
|
* [Folder1](folder1/README.md)
|
||||||
|
* [Folder2](folder2/README.md)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Folder 1
|
||||||
|
|
||||||
|
[Link to folder2](../folder2/README.md)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Folder 2
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Readme
|
||||||
|
|
||||||
|
Default description for the book.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Summary
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
body {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
@@ -21,4 +21,35 @@ describe('eBook generator', function () {
|
|||||||
book.should.have.file("gitbook/style.css");
|
book.should.have.file("gitbook/style.css");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Custom styles', function() {
|
||||||
|
var book;
|
||||||
|
|
||||||
|
before(function() {
|
||||||
|
return books.generate("style-print", "ebook")
|
||||||
|
.then(function(_book) {
|
||||||
|
book = _book;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should remove default print.css', function() {
|
||||||
|
var PAGE = fs.readFileSync(
|
||||||
|
path.join(book.options.output, "index.html"),
|
||||||
|
{ encoding: "utf-8" }
|
||||||
|
);
|
||||||
|
PAGE.should.be.html({
|
||||||
|
"link": {
|
||||||
|
count: 1,
|
||||||
|
attributes: {
|
||||||
|
href: "./styles/print.css"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should correctly print.css', function() {
|
||||||
|
book.should.have.file("styles");
|
||||||
|
book.should.have.file("styles/print.css");
|
||||||
|
});
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
+10
-1
@@ -14,7 +14,7 @@ describe('Glossary', function () {
|
|||||||
|
|
||||||
it('should correctly list items', function() {
|
it('should correctly list items', function() {
|
||||||
book.should.have.property("glossary");
|
book.should.have.property("glossary");
|
||||||
book.glossary.should.have.lengthOf(2);
|
book.glossary.should.have.lengthOf(3);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -73,6 +73,15 @@ describe('Glossary', function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should correctly select the longest term', function() {
|
||||||
|
readme.should.be.html({
|
||||||
|
".page-inner a[href='GLOSSARY.html#test_long']": {
|
||||||
|
count: 1,
|
||||||
|
text: "test long"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
var fs = require('fs');
|
||||||
|
var path = require('path');
|
||||||
|
var should = require('should');
|
||||||
|
|
||||||
|
var Book = require('../').Book;
|
||||||
|
var LOG_LEVELS = require('../').LOG_LEVELS;
|
||||||
|
|
||||||
|
describe('Init Books', function () {
|
||||||
|
var initRoot;
|
||||||
|
|
||||||
|
before(function() {
|
||||||
|
initRoot = path.resolve(__dirname, "books/init");
|
||||||
|
return Book.init(initRoot, {
|
||||||
|
logLevel: LOG_LEVELS.DISABLED,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create all chapters', function() {
|
||||||
|
should(fs.existsSync(path.resolve(initRoot, "hello.md"))).be.ok;
|
||||||
|
should(fs.existsSync(path.resolve(initRoot, "hello2.md"))).be.ok;
|
||||||
|
should(fs.existsSync(path.resolve(initRoot, "hello3/hello4.md"))).be.ok;
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
var should = require('should');
|
var should = require('should');
|
||||||
|
var fs = require('fs');
|
||||||
|
var _ = require('lodash');
|
||||||
|
var path = require('path');
|
||||||
|
var cheerio = require('cheerio');
|
||||||
|
|
||||||
var links = require("../lib/utils/links");
|
var links = require("../lib/utils/links");
|
||||||
|
|
||||||
describe('Links', function () {
|
describe('Links', function () {
|
||||||
@@ -34,4 +39,27 @@ describe('Links', function () {
|
|||||||
links.toAbsolute("/sub/test.md", "test", "test").should.be.equal("../sub/test.md");
|
links.toAbsolute("/sub/test.md", "test", "test").should.be.equal("../sub/test.md");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('page', function() {
|
||||||
|
var book;
|
||||||
|
|
||||||
|
before(function() {
|
||||||
|
return books.generate("links", "website")
|
||||||
|
.then(function(_book) {
|
||||||
|
book = _book;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should correctly replace relative links', function() {
|
||||||
|
var readme = fs.readFileSync(
|
||||||
|
path.join(book.options.output, "folder1/index.html"),
|
||||||
|
{ encoding: "utf-8" }
|
||||||
|
);
|
||||||
|
var $ = cheerio.load(readme);
|
||||||
|
var $a = $(".page-inner a");
|
||||||
|
|
||||||
|
$a.attr('href').should.be.exactly("../folder2/index.html");
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ var should = require('should');
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
var Plugin = require('../lib/plugin');
|
var Plugin = require('../lib/plugin');
|
||||||
|
var parsers = require("gitbook-parsers");
|
||||||
var PLUGINS_ROOT = path.resolve(__dirname, 'plugins');
|
var PLUGINS_ROOT = path.resolve(__dirname, 'plugins');
|
||||||
|
|
||||||
describe('Plugins', function () {
|
describe('Plugins', function () {
|
||||||
@@ -185,6 +186,53 @@ describe('Plugins', function () {
|
|||||||
content.should.equal("hello;the;world");
|
content.should.equal("hello;the;world");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should correctly extend template blocks with arguments', function() {
|
||||||
|
return testTpl('{% test5args "a", "b", "c" %}{% endtest5args %}')
|
||||||
|
.then(function(content) {
|
||||||
|
content.should.equal("test5a,b,ctest5");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should correctly extend template blocks with args and kwargs', function() {
|
||||||
|
return testTpl('{% test5kwargs "a", "b", "c", d="test", e="test2" %}{% endtest5kwargs %}')
|
||||||
|
.then(function(content) {
|
||||||
|
content.should.equal("test5a,b,c,d:test,e:test2,__keywords:truetest5");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Blocks without parsing', function() {
|
||||||
|
var plugin;
|
||||||
|
|
||||||
|
before(function() {
|
||||||
|
plugin = new Plugin(book, "blocks");
|
||||||
|
plugin.load("./blocks", PLUGINS_ROOT);
|
||||||
|
|
||||||
|
return book.plugins.load(plugin);
|
||||||
|
});
|
||||||
|
|
||||||
|
var testTpl = function(markup, str, args, options) {
|
||||||
|
var filetype = parsers.get(markup);
|
||||||
|
|
||||||
|
return book.template.renderString(str, args, options)
|
||||||
|
.then(filetype.page).get('sections').get(0).get('content')
|
||||||
|
.then(book.template.postProcess)
|
||||||
|
};
|
||||||
|
|
||||||
|
it('should correctly process unparsable for markdown', function() {
|
||||||
|
return testTpl('.md', '{% test %}**hello**{% endtest %}')
|
||||||
|
.then(function(content) {
|
||||||
|
content.should.equal("<p>test**hello**test</p>\n");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should correctly process unparsable for asciidoc', function() {
|
||||||
|
return testTpl('.adoc', '{% test %}**hello**{% endtest %}')
|
||||||
|
.then(function(content) {
|
||||||
|
content.should.equal('<div class="paragraph">\n<p>test**hello**test</p>\n</div>');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,21 @@ module.exports = {
|
|||||||
assert(blk.blocks[1].name, "finally");
|
assert(blk.blocks[1].name, "finally");
|
||||||
return [blk.body, blk.blocks[0].body, blk.blocks[1].body].join(blk.kwargs.separator);
|
return [blk.body, blk.blocks[0].body, blk.blocks[1].body].join(blk.kwargs.separator);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"test5args": {
|
||||||
|
process: function(blk) {
|
||||||
|
return "test5"+blk.args.join(',')+"test5";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test5kwargs": {
|
||||||
|
process: function(blk) {
|
||||||
|
var s = blk.args.join(',');
|
||||||
|
for (var key in blk.kwargs) {
|
||||||
|
s = s + ','+key+':'+blk.kwargs[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
return "test5"+s+"test5";
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -41,5 +41,30 @@ describe('Summary', function () {
|
|||||||
book.should.have.file("PAGE1.html");
|
book.should.have.file("PAGE1.html");
|
||||||
book.should.have.file("folder/PAGE2.html");
|
book.should.have.file("folder/PAGE2.html");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should correctly output summary', function() {
|
||||||
|
var PAGE = fs.readFileSync(
|
||||||
|
path.join(book.options.output, "index.html"),
|
||||||
|
{ encoding: "utf-8" }
|
||||||
|
);
|
||||||
|
|
||||||
|
PAGE.should.be.html({
|
||||||
|
".book-summary .chapter[data-level='0'] a": {
|
||||||
|
attributes: {
|
||||||
|
href: "./index.html"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
".book-summary .chapter[data-level='1'] a": {
|
||||||
|
attributes: {
|
||||||
|
href: "./PAGE1.html"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
".book-summary .chapter[data-level='2'] a": {
|
||||||
|
attributes: {
|
||||||
|
href: "./folder/PAGE2.html"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "اكتب للبحث",
|
"SEARCH_PLACEHOLDER": "اكتب للبحث",
|
||||||
"FONTSETTINGS_TOGGLE": "إعدادات الخط",
|
"FONTSETTINGS_TOGGLE": "إعدادات الخط",
|
||||||
"SHARE_TOGGLE": "حصة",
|
"SHARE_TOGGLE": "حصة",
|
||||||
"SHARE_ON": "على __platform__ حصة",
|
"SHARE_ON": "على {{platform}} حصة",
|
||||||
"FONTSETTINGS_WHITE": "أبيض",
|
"FONTSETTINGS_WHITE": "أبيض",
|
||||||
"FONTSETTINGS_SEPIA": "بني داكن",
|
"FONTSETTINGS_SEPIA": "بني داكن",
|
||||||
"FONTSETTINGS_NIGHT": "ليل",
|
"FONTSETTINGS_NIGHT": "ليل",
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "অনুসন্ধান",
|
"SEARCH_PLACEHOLDER": "অনুসন্ধান",
|
||||||
"FONTSETTINGS_TOGGLE": "ফন্ট সেটিংস",
|
"FONTSETTINGS_TOGGLE": "ফন্ট সেটিংস",
|
||||||
"SHARE_TOGGLE": "শেয়ার",
|
"SHARE_TOGGLE": "শেয়ার",
|
||||||
"SHARE_ON": "__platform__-এ শেয়ার",
|
"SHARE_ON": "{{platform}}-এ শেয়ার",
|
||||||
"FONTSETTINGS_WHITE": "সাদা",
|
"FONTSETTINGS_WHITE": "সাদা",
|
||||||
"FONTSETTINGS_SEPIA": "সেপিয়া",
|
"FONTSETTINGS_SEPIA": "সেপিয়া",
|
||||||
"FONTSETTINGS_NIGHT": "রাত",
|
"FONTSETTINGS_NIGHT": "রাত",
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Suchbegriff eingeben",
|
"SEARCH_PLACEHOLDER": "Suchbegriff eingeben",
|
||||||
"FONTSETTINGS_TOGGLE": "Schrifteinstellungen",
|
"FONTSETTINGS_TOGGLE": "Schrifteinstellungen",
|
||||||
"SHARE_TOGGLE": "Teilen",
|
"SHARE_TOGGLE": "Teilen",
|
||||||
"SHARE_ON": "Auf __platform__ teilen",
|
"SHARE_ON": "Auf {{platform}} teilen",
|
||||||
"FONTSETTINGS_WHITE": "Hell",
|
"FONTSETTINGS_WHITE": "Hell",
|
||||||
"FONTSETTINGS_SEPIA": "Sepia",
|
"FONTSETTINGS_SEPIA": "Sepia",
|
||||||
"FONTSETTINGS_NIGHT": "Nacht",
|
"FONTSETTINGS_NIGHT": "Nacht",
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Type to search",
|
"SEARCH_PLACEHOLDER": "Type to search",
|
||||||
"FONTSETTINGS_TOGGLE": "Font Settings",
|
"FONTSETTINGS_TOGGLE": "Font Settings",
|
||||||
"SHARE_TOGGLE": "Share",
|
"SHARE_TOGGLE": "Share",
|
||||||
"SHARE_ON": "Share on __platform__",
|
"SHARE_ON": "Share on {{platform}}",
|
||||||
"FONTSETTINGS_WHITE": "White",
|
"FONTSETTINGS_WHITE": "White",
|
||||||
"FONTSETTINGS_SEPIA": "Sepia",
|
"FONTSETTINGS_SEPIA": "Sepia",
|
||||||
"FONTSETTINGS_NIGHT": "Night",
|
"FONTSETTINGS_NIGHT": "Night",
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Escribe para buscar",
|
"SEARCH_PLACEHOLDER": "Escribe para buscar",
|
||||||
"FONTSETTINGS_TOGGLE": "Configuración de fuente",
|
"FONTSETTINGS_TOGGLE": "Configuración de fuente",
|
||||||
"SHARE_TOGGLE": "Comparte",
|
"SHARE_TOGGLE": "Comparte",
|
||||||
"SHARE_ON": "Comparte en __platform__",
|
"SHARE_ON": "Comparte en {{platform}}",
|
||||||
"FONTSETTINGS_WHITE": "Claro",
|
"FONTSETTINGS_WHITE": "Claro",
|
||||||
"FONTSETTINGS_SEPIA": "Sépia",
|
"FONTSETTINGS_SEPIA": "Sépia",
|
||||||
"FONTSETTINGS_NIGHT": "Noche",
|
"FONTSETTINGS_NIGHT": "Noche",
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "چیزی برای جستجو بنویسید",
|
"SEARCH_PLACEHOLDER": "چیزی برای جستجو بنویسید",
|
||||||
"FONTSETTINGS_TOGGLE": "تنظیمات فونت",
|
"FONTSETTINGS_TOGGLE": "تنظیمات فونت",
|
||||||
"SHARE_TOGGLE": "اشتراک",
|
"SHARE_TOGGLE": "اشتراک",
|
||||||
"SHARE_ON": "در __platform__ به اشتراک بگذارید",
|
"SHARE_ON": "در {{platform}} به اشتراک بگذارید",
|
||||||
"FONTSETTINGS_WHITE": "سفید",
|
"FONTSETTINGS_WHITE": "سفید",
|
||||||
"FONTSETTINGS_SEPIA": "سپیا",
|
"FONTSETTINGS_SEPIA": "سپیا",
|
||||||
"FONTSETTINGS_NIGHT": "شب",
|
"FONTSETTINGS_NIGHT": "شب",
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"LANGS_CHOOSE": "Valitse kieli",
|
||||||
|
"GLOSSARY": "Sanasto",
|
||||||
|
"GLOSSARY_INDEX": "Hakemisto",
|
||||||
|
"GLOSSARY_OPEN": "Sanasto",
|
||||||
|
"GITBOOK_LINK": "Julkaistu GitBookilla",
|
||||||
|
"SUMMARY": "Sisällysluettelo",
|
||||||
|
"SUMMARY_INTRODUCTION": "Johdanto",
|
||||||
|
"SUMMARY_TOGGLE": "Sisällysluettelu",
|
||||||
|
"SEARCH_TOGGLE": "Etsi",
|
||||||
|
"SEARCH_PLACEHOLDER": "Kirjoita hakusana",
|
||||||
|
"FONTSETTINGS_TOGGLE": "Fonttivalinnat",
|
||||||
|
"SHARE_TOGGLE": "Jaa",
|
||||||
|
"SHARE_ON": "Jaa {{platform}}ssa",
|
||||||
|
"FONTSETTINGS_WHITE": "Valkoinen",
|
||||||
|
"FONTSETTINGS_SEPIA": "Seepia",
|
||||||
|
"FONTSETTINGS_NIGHT": "Yö",
|
||||||
|
"FONTSETTINGS_SANS": "Sans",
|
||||||
|
"FONTSETTINGS_SERIF": "Serif"
|
||||||
|
}
|
||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Tapez pour rechercher",
|
"SEARCH_PLACEHOLDER": "Tapez pour rechercher",
|
||||||
"FONTSETTINGS_TOGGLE": "Paramètres de Police",
|
"FONTSETTINGS_TOGGLE": "Paramètres de Police",
|
||||||
"SHARE_TOGGLE": "Partage",
|
"SHARE_TOGGLE": "Partage",
|
||||||
"SHARE_ON": "Partager sur __platform__",
|
"SHARE_ON": "Partager sur {{platform}}",
|
||||||
"FONTSETTINGS_WHITE": "Clair",
|
"FONTSETTINGS_WHITE": "Clair",
|
||||||
"FONTSETTINGS_SEPIA": "Sépia",
|
"FONTSETTINGS_SEPIA": "Sépia",
|
||||||
"FONTSETTINGS_NIGHT": "Nuit",
|
"FONTSETTINGS_NIGHT": "Nuit",
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"direction": "rtl",
|
||||||
|
"LANGS_CHOOSE": "בחר שפה",
|
||||||
|
"GLOSSARY": "מונחים",
|
||||||
|
"GLOSSARY_INDEX": "מפתח",
|
||||||
|
"GLOSSARY_OPEN": "מונחים",
|
||||||
|
"GITBOOK_LINK": "הוצאה לאור באמצעות גיט-בוק GITBOOK",
|
||||||
|
"SUMMARY": "תוכן העניינים",
|
||||||
|
"SUMMARY_INTRODUCTION": "הוראות",
|
||||||
|
"SUMMARY_TOGGLE": "תקציר",
|
||||||
|
"SEARCH_TOGGLE": "חיפוש",
|
||||||
|
"SEARCH_PLACEHOLDER": "סוג החיפוש",
|
||||||
|
"FONTSETTINGS_TOGGLE": "הגדרת אותיות",
|
||||||
|
"SHARE_TOGGLE": "שתף",
|
||||||
|
"SHARE_ON": "{{platform}} שתף ב",
|
||||||
|
"FONTSETTINGS_WHITE": "בהיר",
|
||||||
|
"FONTSETTINGS_SEPIA": "חום כהה",
|
||||||
|
"FONTSETTINGS_NIGHT": "מצב לילה",
|
||||||
|
"FONTSETTINGS_SANS": "Sans",
|
||||||
|
"FONTSETTINGS_SERIF": "Serif"
|
||||||
|
}
|
||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Scrivi per cercare",
|
"SEARCH_PLACEHOLDER": "Scrivi per cercare",
|
||||||
"FONTSETTINGS_TOGGLE": "Impostazioni dei caratteri",
|
"FONTSETTINGS_TOGGLE": "Impostazioni dei caratteri",
|
||||||
"SHARE_TOGGLE": "Condividi",
|
"SHARE_TOGGLE": "Condividi",
|
||||||
"SHARE_ON": "Condividi su __platform__",
|
"SHARE_ON": "Condividi su {{platform}}",
|
||||||
"FONTSETTINGS_WHITE": "Bianco",
|
"FONTSETTINGS_WHITE": "Bianco",
|
||||||
"FONTSETTINGS_SEPIA": "Seppia",
|
"FONTSETTINGS_SEPIA": "Seppia",
|
||||||
"FONTSETTINGS_NIGHT": "Notte",
|
"FONTSETTINGS_NIGHT": "Notte",
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"LANGS_CHOOSE": "言語を選択",
|
||||||
|
"GLOSSARY": "用語集",
|
||||||
|
"GLOSSARY_INDEX": "インデックス",
|
||||||
|
"GLOSSARY_OPEN": "用語集",
|
||||||
|
"GITBOOK_LINK": "で公開 GitBook",
|
||||||
|
"SUMMARY": "目次",
|
||||||
|
"SUMMARY_INTRODUCTION": "はじめに",
|
||||||
|
"SUMMARY_TOGGLE": "目次",
|
||||||
|
"SEARCH_TOGGLE": "検索",
|
||||||
|
"SEARCH_PLACEHOLDER": "検索すると入力",
|
||||||
|
"FONTSETTINGS_TOGGLE": "フォント設定",
|
||||||
|
"SHARE_TOGGLE": "シェア",
|
||||||
|
"SHARE_ON": "でシェア {{platform}}",
|
||||||
|
"FONTSETTINGS_WHITE": "白",
|
||||||
|
"FONTSETTINGS_SEPIA": "Sepia",
|
||||||
|
"FONTSETTINGS_NIGHT": "夜",
|
||||||
|
"FONTSETTINGS_SANS": "Sans",
|
||||||
|
"FONTSETTINGS_SERIF": "Serif"
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"LANGS_CHOOSE": "언어를 선택하세요",
|
||||||
|
"GLOSSARY": "어휘",
|
||||||
|
"GLOSSARY_INDEX": "색인",
|
||||||
|
"GLOSSARY_OPEN": "어휘",
|
||||||
|
"GITBOOK_LINK": "GitBook에 게시",
|
||||||
|
"SUMMARY": "차례",
|
||||||
|
"SUMMARY_INTRODUCTION": "소개",
|
||||||
|
"SUMMARY_TOGGLE": "차례",
|
||||||
|
"SEARCH_TOGGLE": "검색",
|
||||||
|
"SEARCH_PLACEHOLDER": "검색어 입력",
|
||||||
|
"FONTSETTINGS_TOGGLE": "글꼴 설정",
|
||||||
|
"SHARE_TOGGLE": "공유",
|
||||||
|
"SHARE_ON": "{{platform}}에 공유",
|
||||||
|
"FONTSETTINGS_WHITE": "화이트",
|
||||||
|
"FONTSETTINGS_SEPIA": "세피아",
|
||||||
|
"FONTSETTINGS_NIGHT": "나이트",
|
||||||
|
"FONTSETTINGS_SANS": "고딕",
|
||||||
|
"FONTSETTINGS_SERIF": "명조"
|
||||||
|
}
|
||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Skriv inn søkeord",
|
"SEARCH_PLACEHOLDER": "Skriv inn søkeord",
|
||||||
"FONTSETTINGS_TOGGLE": "Tekstinnstillinger",
|
"FONTSETTINGS_TOGGLE": "Tekstinnstillinger",
|
||||||
"SHARE_TOGGLE": "Del",
|
"SHARE_TOGGLE": "Del",
|
||||||
"SHARE_ON": "Del på __platform__",
|
"SHARE_ON": "Del på {{platform}}",
|
||||||
"FONTSETTINGS_WHITE": "Lys",
|
"FONTSETTINGS_WHITE": "Lys",
|
||||||
"FONTSETTINGS_SEPIA": "Sepia",
|
"FONTSETTINGS_SEPIA": "Sepia",
|
||||||
"FONTSETTINGS_NIGHT": "Mørk",
|
"FONTSETTINGS_NIGHT": "Mørk",
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"LANGS_CHOOSE": "Wybierz język",
|
||||||
|
"GLOSSARY": "Glosariusz",
|
||||||
|
"GLOSSARY_INDEX": "Indeks",
|
||||||
|
"GLOSSARY_OPEN": "Glosariusz",
|
||||||
|
"GITBOOK_LINK": "Opublikowano dzięki GitBook",
|
||||||
|
"SUMMARY": "Spis treści",
|
||||||
|
"SUMMARY_INTRODUCTION": "Wstęp",
|
||||||
|
"SUMMARY_TOGGLE": "Spis treści",
|
||||||
|
"SEARCH_TOGGLE": "Szukaj",
|
||||||
|
"SEARCH_PLACEHOLDER": "Wpisz szukaną frazę",
|
||||||
|
"FONTSETTINGS_TOGGLE": "Ustawienia czcionki",
|
||||||
|
"SHARE_TOGGLE": "Udostępnij",
|
||||||
|
"SHARE_ON": "Udostępnij na {{platform}}",
|
||||||
|
"FONTSETTINGS_WHITE": "Jasny",
|
||||||
|
"FONTSETTINGS_SEPIA": "Sepia",
|
||||||
|
"FONTSETTINGS_NIGHT": "Noc",
|
||||||
|
"FONTSETTINGS_SANS": "Bezszeryfowa",
|
||||||
|
"FONTSETTINGS_SERIF": "Szeryfowa"
|
||||||
|
}
|
||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Escreva para pesquisar",
|
"SEARCH_PLACEHOLDER": "Escreva para pesquisar",
|
||||||
"FONTSETTINGS_TOGGLE": "Configurações de fonte",
|
"FONTSETTINGS_TOGGLE": "Configurações de fonte",
|
||||||
"SHARE_TOGGLE": "Compartilhar",
|
"SHARE_TOGGLE": "Compartilhar",
|
||||||
"SHARE_ON": "Compartilhar no __platform__",
|
"SHARE_ON": "Compartilhar no {{platform}}",
|
||||||
"FONTSETTINGS_WHITE": "Claro",
|
"FONTSETTINGS_WHITE": "Claro",
|
||||||
"FONTSETTINGS_SEPIA": "Sépia",
|
"FONTSETTINGS_SEPIA": "Sépia",
|
||||||
"FONTSETTINGS_NIGHT": "Noite",
|
"FONTSETTINGS_NIGHT": "Noite",
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"LANGS_CHOOSE": "Alege o limba",
|
||||||
|
"GLOSSARY": "Glosar",
|
||||||
|
"GLOSSARY_INDEX": "Index",
|
||||||
|
"GLOSSARY_OPEN": "Glosar",
|
||||||
|
"GITBOOK_LINK": "Publicata cu GitBook",
|
||||||
|
"SUMMARY": "Cuprins",
|
||||||
|
"SUMMARY_INTRODUCTION": "Introducere",
|
||||||
|
"SUMMARY_TOGGLE": "Cuprins",
|
||||||
|
"SEARCH_TOGGLE": "Cauta",
|
||||||
|
"SEARCH_PLACEHOLDER": "Ce cauti",
|
||||||
|
"FONTSETTINGS_TOGGLE": "Setari de font",
|
||||||
|
"SHARE_TOGGLE": "Distribuie",
|
||||||
|
"SHARE_ON": "Distribuie pe {{platform}}",
|
||||||
|
"FONTSETTINGS_WHITE": "Alb",
|
||||||
|
"FONTSETTINGS_SEPIA": "Sepia",
|
||||||
|
"FONTSETTINGS_NIGHT": "Noapte",
|
||||||
|
"FONTSETTINGS_SANS": "Sans",
|
||||||
|
"FONTSETTINGS_SERIF": "Serif"
|
||||||
|
}
|
||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Введите условия поиска",
|
"SEARCH_PLACEHOLDER": "Введите условия поиска",
|
||||||
"FONTSETTINGS_TOGGLE": "Шрифт",
|
"FONTSETTINGS_TOGGLE": "Шрифт",
|
||||||
"SHARE_TOGGLE": "Поделиться",
|
"SHARE_TOGGLE": "Поделиться",
|
||||||
"SHARE_ON": "Поделиться в __platform__",
|
"SHARE_ON": "Поделиться в {{platform}}",
|
||||||
"FONTSETTINGS_WHITE": "Светлый",
|
"FONTSETTINGS_WHITE": "Светлый",
|
||||||
"FONTSETTINGS_SEPIA": "Сепия",
|
"FONTSETTINGS_SEPIA": "Сепия",
|
||||||
"FONTSETTINGS_NIGHT": "Тёмный",
|
"FONTSETTINGS_NIGHT": "Тёмный",
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"LANGS_CHOOSE": "Lựa chọn ngôn ngữ",
|
||||||
|
"GLOSSARY": "Chú giải",
|
||||||
|
"GLOSSARY_INDEX": "Chỉ mục",
|
||||||
|
"GLOSSARY_OPEN": "Chú giải",
|
||||||
|
"GITBOOK_LINK": "Xuất bản với GitBook",
|
||||||
|
"SUMMARY": "Mục Lục",
|
||||||
|
"SUMMARY_INTRODUCTION": "Giới thiệu",
|
||||||
|
"SUMMARY_TOGGLE": "Mục Lục",
|
||||||
|
"SEARCH_TOGGLE": "Tìm kiếm",
|
||||||
|
"SEARCH_PLACEHOLDER": "Nhập thông tin cần tìm",
|
||||||
|
"FONTSETTINGS_TOGGLE": "Tùy chỉnh phông chữ",
|
||||||
|
"SHARE_TOGGLE": "Chia sẻ",
|
||||||
|
"SHARE_ON": "Chia sẻ trên {{platform}}",
|
||||||
|
"FONTSETTINGS_WHITE": "Sáng",
|
||||||
|
"FONTSETTINGS_SEPIA": "Vàng nâu",
|
||||||
|
"FONTSETTINGS_NIGHT": "Tối",
|
||||||
|
"FONTSETTINGS_SANS": "Sans",
|
||||||
|
"FONTSETTINGS_SERIF": "Serif"
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "输入并搜索",
|
"SEARCH_PLACEHOLDER": "输入并搜索",
|
||||||
"FONTSETTINGS_TOGGLE": "字体设置",
|
"FONTSETTINGS_TOGGLE": "字体设置",
|
||||||
"SHARE_TOGGLE": "分享",
|
"SHARE_TOGGLE": "分享",
|
||||||
"SHARE_ON": "分享到 __platform__",
|
"SHARE_ON": "分享到 {{platform}}",
|
||||||
"FONTSETTINGS_WHITE": "白色",
|
"FONTSETTINGS_WHITE": "白色",
|
||||||
"FONTSETTINGS_SEPIA": "棕褐色",
|
"FONTSETTINGS_SEPIA": "棕褐色",
|
||||||
"FONTSETTINGS_NIGHT": "夜间",
|
"FONTSETTINGS_NIGHT": "夜间",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "輸入並搜尋",
|
"SEARCH_PLACEHOLDER": "輸入並搜尋",
|
||||||
"FONTSETTINGS_TOGGLE": "字型設定",
|
"FONTSETTINGS_TOGGLE": "字型設定",
|
||||||
"SHARE_TOGGLE": "分享",
|
"SHARE_TOGGLE": "分享",
|
||||||
"SHARE_ON": "分享到 __platform__",
|
"SHARE_ON": "分享到 {{platform}}",
|
||||||
"FONTSETTINGS_WHITE": "白色",
|
"FONTSETTINGS_WHITE": "白色",
|
||||||
"FONTSETTINGS_SEPIA": "棕褐色",
|
"FONTSETTINGS_SEPIA": "棕褐色",
|
||||||
"FONTSETTINGS_NIGHT": "夜間",
|
"FONTSETTINGS_NIGHT": "夜間",
|
||||||
|
|||||||
@@ -35,13 +35,25 @@ define([
|
|||||||
var $pageHead = $page.find("[data-element=head]");
|
var $pageHead = $page.find("[data-element=head]");
|
||||||
var $pageBody = $page.find('.book');
|
var $pageBody = $page.find('.book');
|
||||||
|
|
||||||
|
////
|
||||||
// Merge heads
|
// Merge heads
|
||||||
var headContent = $pageHead.html()
|
// !! Warning !!: we only update necessary portions to avoid strange behavior (page flickering etc ...)
|
||||||
|
////
|
||||||
|
|
||||||
$("head style").each(function() {
|
// Update title
|
||||||
headContent = headContent + this.outerHTML
|
document.title = $pageHead.find("title").text();
|
||||||
});
|
|
||||||
$("head").html(headContent);
|
// Reference to $("head");
|
||||||
|
var $head = $("head");
|
||||||
|
|
||||||
|
// Update next & prev <link> tags
|
||||||
|
// Remove old
|
||||||
|
$head.find("link[rel=prev]").remove();
|
||||||
|
$head.find("link[rel=next]").remove();
|
||||||
|
|
||||||
|
// Add new next * prev <link> tags
|
||||||
|
$head.append($pageHead.find("link[rel=prev]"));
|
||||||
|
$head.append($pageHead.find("link[rel=next]"));
|
||||||
|
|
||||||
// Merge body
|
// Merge body
|
||||||
var bodyClass = $(".book").attr("class");
|
var bodyClass = $(".book").attr("class");
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ define([
|
|||||||
},
|
},
|
||||||
"instapaper": function($el) {
|
"instapaper": function($el) {
|
||||||
window.open("http://www.instapaper.com/text?u="+encodeURIComponent(location.href));
|
window.open("http://www.instapaper.com/text?u="+encodeURIComponent(location.href));
|
||||||
|
},
|
||||||
|
"vk": function($el) {
|
||||||
|
window.open("http://vkontakte.ru/share.php?url="+encodeURIComponent(location.href));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
pre {
|
pre {
|
||||||
font-family: monospace, monospace;
|
font-family: monospace, monospace;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
|
direction: ltr;
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
|
|||||||
@@ -39,6 +39,6 @@
|
|||||||
body {
|
body {
|
||||||
.page {
|
.page {
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
.markdown-content(#333, 1.6);
|
.markdown-content(#000, 1.6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
@import "mixins.less";
|
@import "mixins.less";
|
||||||
|
|
||||||
@import "website/fonts.less";
|
|
||||||
@import "website/variables.less";
|
@import "website/variables.less";
|
||||||
@import "website/languages.less";
|
@import "website/languages.less";
|
||||||
@import "website/header.less";
|
@import "website/header.less";
|
||||||
@@ -44,4 +43,5 @@ body {
|
|||||||
font-smoothing: antialiased;
|
font-smoothing: antialiased;
|
||||||
font-family: @font-family-base;
|
font-family: @font-family-base;
|
||||||
font-size: @font-size-base;
|
font-size: @font-size-base;
|
||||||
|
letter-spacing: .2px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
@font-face {
|
|
||||||
font-family: 'Merriweather';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 250;
|
|
||||||
src: local('Merriweather Light'),url('@{FontPath}/merriweather/250.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Merriweather';
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 250;
|
|
||||||
src: local('Merriweather Light Italic'),url('@{FontPath}/merriweather/250i.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Merriweather';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
src: local('Merriweather'),url('@{FontPath}/merriweather/400.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Merriweather';
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 400;
|
|
||||||
src: local('Merriweather Italic'),url('@{FontPath}/merriweather/400i.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Merriweather';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 700;
|
|
||||||
src: local('Merriweather Bold'),url('@{FontPath}/merriweather/700.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Merriweather';
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 700;
|
|
||||||
src: local('Merriweather Bold Italic'),url('@{FontPath}/merriweather/700i.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Merriweather';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 900;
|
|
||||||
src: local('Merriweather Heavy'),url('@{FontPath}/merriweather/900.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Merriweather';
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 900;
|
|
||||||
src: local('Merriweather Heavy Italic'),url('@{FontPath}/merriweather/900i.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 300;
|
|
||||||
src: local('Open Sans Light'),url('@{FontPath}/opensans/300.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 300;
|
|
||||||
src: local('Open Sans Light Italic'),url('@{FontPath}/opensans/300i.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
src: local('Open Sans Regular'),url('@{FontPath}/opensans/400.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 400;
|
|
||||||
src: local('Open Sans Italic'),url('@{FontPath}/opensans/400i.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 600;
|
|
||||||
src: local('Open Sans Semibold'),url('@{FontPath}/opensans/600.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 600;
|
|
||||||
src: local('Open Sans Semibold Italic'),url('@{FontPath}/opensans/600i.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 700;
|
|
||||||
src: local('Open Sans Bold'),url('@{FontPath}/opensans/700.woff') format('woff');
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 700;
|
|
||||||
src: local('Open Sans Bold Italic'),url('@{FontPath}/opensans/700i.woff') format('woff');
|
|
||||||
}
|
|
||||||
@@ -95,8 +95,8 @@
|
|||||||
@border-radius-small: 1px;
|
@border-radius-small: 1px;
|
||||||
|
|
||||||
// Fonts
|
// Fonts
|
||||||
@font-family-serif: "Merriweather", Georgia, serif;
|
@font-family-serif: Georgia, serif;
|
||||||
@font-family-sans: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
@font-family-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
@font-family-base: @font-family-sans;
|
@font-family-base: @font-family-sans;
|
||||||
@headings-font-family: inherit;
|
@headings-font-family: inherit;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
{% extends "./page.html" %}
|
{% extends "./page.html" %}
|
||||||
|
|
||||||
{% block title %}{% i18n "GLOSSARY" %}Glossary{% endi18n %} | {{ title }}{% endblock %}
|
{% block title %}{{ __("GLOSSARY") }} | {{ title }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="page page-toc">
|
<div class="page page-toc">
|
||||||
<h1 class="book-chapter book-chapter-1">{% i18n "GLOSSARY" %}Glossary{% endi18n %}</h1>
|
<h1 class="book-chapter book-chapter-1">{{ __("GLOSSARY") }}</h1>
|
||||||
<h1>{% i18n "GLOSSARY" %}Glossary{% endi18n %}</h1>
|
<h1>{{ __("GLOSSARY") }}</h1>
|
||||||
{% for item in glossary %}
|
{% for item in glossary %}
|
||||||
<section class="normal glossary" id="{{ item.id }}">
|
<section class="normal glossary" id="{{ item.id }}">
|
||||||
<h2><a href="#{{ item.id }}">{{ item.name }}</a></h2>
|
<h2><a href="#{{ item.id }}">{{ item.name }}</a></h2>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html lang="{{ language }}" {% block htmlTag %}{% endblock %} {% if options.direction == "rtl" %}dir="rtl"{% endif %}>
|
<html lang="{{ language }}" {% block htmlTag %}{% endblock %} {% if options.direction == "rtl" %}dir="rtl"{% endif %}>
|
||||||
{{ htmlSnippet("html:start")|default("")|safe }}
|
{{ htmlSnippet("html:start")|default("", true)|safe }}
|
||||||
<head>
|
<head>
|
||||||
{{ htmlSnippet("head:start")|default("")|safe }}
|
{{ htmlSnippet("head:start")|default("", true)|safe }}
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{% block title %}{% endblock %}</title>
|
<title>{% block title %}{% endblock %}</title>
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||||
@@ -11,14 +11,14 @@
|
|||||||
{% if options.author %}<meta name="author" content="{{ options.author }}">{% endif %}
|
{% if options.author %}<meta name="author" content="{{ options.author }}">{% endif %}
|
||||||
{% if options.isbn %}<meta name="identifier" content="{{ options.isbn }}" scheme="ISBN">{% endif %}
|
{% if options.isbn %}<meta name="identifier" content="{{ options.isbn }}" scheme="ISBN">{% endif %}
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
{{ htmlSnippet("head:end")|default("")|safe }}
|
{% block style %}{% endblock %}
|
||||||
|
{{ htmlSnippet("head:end")|default("", true)|safe }}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{ htmlSnippet("body:start")|default("")|safe }}
|
{{ htmlSnippet("body:start")|default("", true)|safe }}
|
||||||
{% block style %}{% endblock %}
|
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
{% block javascript %}{% endblock %}
|
{% block javascript %}{% endblock %}
|
||||||
{{ htmlSnippet("body:end")|default("")|safe }}
|
{{ htmlSnippet("body:end")|default("", true)|safe }}
|
||||||
</body>
|
</body>
|
||||||
{{ htmlSnippet("html:end")|default("")|safe }}
|
{{ htmlSnippet("html:end")|default("", true)|safe }}
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
{% block title %}{{ progress.current.title }} | {{ title }}{% endblock %}
|
{% block title %}{{ progress.current.title }} | {{ title }}{% endblock %}
|
||||||
|
|
||||||
{% block style %}
|
{% block style %}
|
||||||
|
{% if not styles.print %}
|
||||||
<link rel="stylesheet" href="{{ staticBase }}/print.css">
|
<link rel="stylesheet" href="{{ staticBase }}/print.css">
|
||||||
|
{% endif %}
|
||||||
{% for resource in plugins.resources.css %}
|
{% for resource in plugins.resources.css %}
|
||||||
{% if resource.url %}
|
{% if resource.url %}
|
||||||
<link rel="stylesheet" href="{{ resource.url }}">
|
<link rel="stylesheet" href="{{ resource.url }}">
|
||||||
@@ -11,7 +13,7 @@
|
|||||||
<link rel="stylesheet" href="{{ staticBase }}/plugins/{{ resource.path }}">
|
<link rel="stylesheet" href="{{ staticBase }}/plugins/{{ resource.path }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% for style in styles %}
|
{% for type, style in styles %}
|
||||||
<link rel="stylesheet" href="{{ basePath }}/{{ style }}">
|
<link rel="stylesheet" href="{{ basePath }}/{{ style }}">
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
{% extends "./page.html" %}
|
{% extends "./page.html" %}
|
||||||
|
|
||||||
{% block title %}{% i18n "SUMMARY" %}Table of Contents{% endi18n %} | {{ title }}{% endblock %}
|
{% block title %}{{ __("SUMMARY") }} | {{ title }}{% endblock %}
|
||||||
|
|
||||||
{% macro articles(_articles) %}
|
{% macro articles(_articles) %}
|
||||||
{% for item in _articles %}
|
{% for item in _articles %}
|
||||||
<li>
|
<li>
|
||||||
{% if item.path and item.exists %}
|
{% if item.path and item.exists %}
|
||||||
{% if not item.external %}
|
{% if not item.external %}
|
||||||
<a href="{{ basePath }}/{{ item.path|contentLink }}">{% if item.introduction %}{% i18n "SUMMARY_INTRODUCTION" %}Introduction{% endi18n %}{% else %}{{ item.title }}{% endif %}</a>
|
<a href="{{ basePath }}/{{ item.path|contentLink }}">{{ item.title }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a target="_blank" href="{{ item.path }}">{{ item.title }}</a>
|
<a target="_blank" href="{{ item.path }}">{{ item.title }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -25,12 +25,12 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="page page-toc">
|
<div class="page page-toc">
|
||||||
<h1>{% i18n "SUMMARY" %}Table of Contents{% endi18n %}</h1>
|
<h1>{{ __("SUMMARY") }}</h1>
|
||||||
<ol>
|
<ol>
|
||||||
{{ articles(summary.chapters) }}
|
{{ articles(summary.chapters) }}
|
||||||
|
|
||||||
{% if glossary.length > 0 %}
|
{% if glossary.length > 0 %}
|
||||||
<li><a href="{{ basePath }}/GLOSSARY.html">{% i18n "GLOSSARY" %}Glossary{% endi18n %}</a></li>
|
<li><a href="{{ basePath }}/GLOSSARY.html">{{ __("GLOSSARY") }}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{% extends "page.html" %}
|
{% extends "page.html" %}
|
||||||
|
|
||||||
{% block title %}{% i18n "GLOSSARY" %}Glossary{% endi18n %} | {{ title }}{% endblock %}
|
{% block title %}{{ __("GLOSSARY") }} | {{ title }}{% endblock %}
|
||||||
|
|
||||||
{% block page_inner %}
|
{% block page_inner %}
|
||||||
{% for item in glossary %}
|
{% for item in glossary %}
|
||||||
|
|||||||
@@ -10,13 +10,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buttons font-family-list">
|
<div class="buttons font-family-list">
|
||||||
<button type="button" data-font="0" class="button">{% i18n "FONTSETTINGS_SERIF" %}Serif{% endi18n %}</button>
|
<button type="button" data-font="0" class="button">{{ __("FONTSETTINGS_SERIF") }}</button>
|
||||||
<button type="button" data-font="1" class="button">{% i18n "FONTSETTINGS_SANS" %}Sans{% endi18n %}</button>
|
<button type="button" data-font="1" class="button">{{ __("FONTSETTINGS_SANS") }}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buttons color-theme-list">
|
<div class="buttons color-theme-list">
|
||||||
<button type="button" id="color-theme-preview-0" class="button size-3" data-theme="0">{% i18n "FONTSETTINGS_WHITE" %}White{% endi18n %}</button>
|
<button type="button" id="color-theme-preview-0" class="button size-3" data-theme="0">{{ __("FONTSETTINGS_WHITE") }}</button>
|
||||||
<button type="button" id="color-theme-preview-1" class="button size-3" data-theme="1">{% i18n "FONTSETTINGS_SEPIA" %}Sepia{% endi18n %}</button>
|
<button type="button" id="color-theme-preview-1" class="button size-3" data-theme="1">{{ __("FONTSETTINGS_SEPIA") }}</button>
|
||||||
<button type="button" id="color-theme-preview-2" class="button size-3" data-theme="2">{% i18n "FONTSETTINGS_NIGHT" %}Night{% endi18n %}</button>
|
<button type="button" id="color-theme-preview-2" class="button size-3" data-theme="2">{{ __("FONTSETTINGS_NIGHT") }}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="{% i18n "SUMMARY_TOGGLE" %}Table of Contents{% endi18n %}"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="{{ __("SUMMARY_TOGGLE") }}"><i class="fa fa-align-justify"></i></a>
|
||||||
<a href="#" class="btn pull-left toggle-search" aria-label="{% i18n "SEARCH_TOGGLE" %}Search{% endi18n %}"><i class="fa fa-search"></i></a>
|
<a href="#" class="btn pull-left toggle-search" aria-label="{{ __("SEARCH_TOGGLE") }}"><i class="fa fa-search"></i></a>
|
||||||
{% if glossary.length > 0 %}
|
{% if glossary.length > 0 %}
|
||||||
<a href="{{ basePath }}/GLOSSARY.html" class="btn pull-left" aria-label="{% i18n "GLOSSARY_OPEN" %}Glossary{% endi18n %}"><i class="fa fa-sort-alpha-asc"></i></a>
|
<a href="{{ basePath }}/GLOSSARY.html" class="btn pull-left" aria-label="{{ __("GLOSSARY_OPEN") }}"><i class="fa fa-sort-alpha-asc"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div id="font-settings-wrapper" class="dropdown pull-left">
|
<div id="font-settings-wrapper" class="dropdown pull-left">
|
||||||
<a href="#" class="btn toggle-dropdown" aria-label="{% i18n "FONTSETTINGS_TOGGLE" %}Font Settings{% endi18n %}"><i class="fa fa-font"></i>
|
<a href="#" class="btn toggle-dropdown" aria-label="{{ __("FONTSETTINGS_TOGGLE") }}"><i class="fa fa-font"></i>
|
||||||
</a>
|
</a>
|
||||||
{% include "./font-settings.html" %}
|
{% include "./font-settings.html" %}
|
||||||
</div>
|
</div>
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<!-- Actions Right -->
|
<!-- Actions Right -->
|
||||||
{% if options.links.sharing.all != false %}
|
{% if options.links.sharing.all != false %}
|
||||||
<div class="dropdown pull-right">
|
<div class="dropdown pull-right">
|
||||||
<a href="#" class="btn toggle-dropdown" aria-label="{% i18n "SHARE_TOGGLE" %}Share{% endi18n %}"><i class="fa fa-share-alt"></i>
|
<a href="#" class="btn toggle-dropdown" aria-label="{{ __("SHARE_TOGGLE") }}"><i class="fa fa-share-alt"></i>
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu font-settings dropdown-left">
|
<div class="dropdown-menu font-settings dropdown-left">
|
||||||
<div class="dropdown-caret">
|
<div class="dropdown-caret">
|
||||||
@@ -22,11 +22,21 @@
|
|||||||
<span class="caret-inner"></span>
|
<span class="caret-inner"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button type="button" data-sharing="twitter" class="button">{% i18n "SHARE_ON", __platform__="Twitter" %}Share on __platform__{% endi18n %}</button>
|
<button type="button" data-sharing="twitter" class="button">
|
||||||
<button type="button" data-sharing="google-plus" class="button">{% i18n "SHARE_ON", __platform__="Google" %}Share on __platform__{% endi18n %}</button>
|
{{ __("SHARE_ON", platform="Twitter") }}
|
||||||
<button type="button" data-sharing="facebook" class="button">{% i18n "SHARE_ON", __platform__="Facebook" %}Share on __platform__{% endi18n %}</button>
|
</button>
|
||||||
<button type="button" data-sharing="weibo" class="button">{% i18n "SHARE_ON", __platform__="Weibo" %}Share on __platform__{% endi18n %}</button>
|
<button type="button" data-sharing="google-plus" class="button">
|
||||||
<button type="button" data-sharing="instapaper" class="button">{% i18n "SHARE_ON", __platform__="Instapaper" %}Share on __platform__{% endi18n %}</button>
|
{{ __("SHARE_ON", platform="Google") }}
|
||||||
|
</button>
|
||||||
|
<button type="button" data-sharing="facebook" class="button">
|
||||||
|
{{ __("SHARE_ON", platform="Facebook") }}
|
||||||
|
</button>
|
||||||
|
<button type="button" data-sharing="weibo" class="button">
|
||||||
|
{{ __("SHARE_ON", platform="Weibo") }}
|
||||||
|
</button>
|
||||||
|
<button type="button" data-sharing="instapaper" class="button">
|
||||||
|
{{ __("SHARE_ON", platform="Instapaper") }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,6 +54,10 @@
|
|||||||
{% if options.links.sharing.weibo == true %}
|
{% if options.links.sharing.weibo == true %}
|
||||||
<a href="#" target="_blank" class="btn pull-right weibo-sharing-link sharing-link" data-sharing="weibo" aria-label="Weibo"><i class="fa fa-weibo"></i></a>
|
<a href="#" target="_blank" class="btn pull-right weibo-sharing-link sharing-link" data-sharing="weibo" aria-label="Weibo"><i class="fa fa-weibo"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if options.links.sharing.vk == true %}
|
||||||
|
<a href="#" target="_blank" class="btn pull-right vk-sharing-link sharing-link" data-sharing="vk" aria-label="VK"><i class="fa fa-vk"></i></a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<!-- Title -->
|
<!-- Title -->
|
||||||
<h1>
|
<h1>
|
||||||
|
|||||||
@@ -4,21 +4,15 @@
|
|||||||
{% if item.path and item.exists %}
|
{% if item.path and item.exists %}
|
||||||
{% if not item.external %}
|
{% if not item.external %}
|
||||||
<a href="{{ basePath }}/{{ item.path|contentLink }}">
|
<a href="{{ basePath }}/{{ item.path|contentLink }}">
|
||||||
<i class="fa fa-check"></i>
|
|
||||||
{% if item.level != "0" %}
|
|
||||||
<b>{{ item.level }}.</b>
|
|
||||||
{% endif %}
|
|
||||||
{% if item.introduction and not item.title %}{% i18n "SUMMARY_INTRODUCTION" %}Introduction{% endi18n %}{% else %}{{ item.title }}{% endif %}
|
|
||||||
</a>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<a target="_blank" href="{{ item.path }}">
|
<a target="_blank" href="{{ item.path }}">
|
||||||
|
{% endif %}
|
||||||
<i class="fa fa-check"></i>
|
<i class="fa fa-check"></i>
|
||||||
{% if item.level != "0" %}
|
{% if item.level != "0" %}
|
||||||
<b>{{ item.level }}.</b>
|
<b>{{ item.level }}.</b>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<span><b>{{ item.level }}.</b> {{ item.title }}</span>
|
<span><b>{{ item.level }}.</b> {{ item.title }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -33,7 +27,7 @@
|
|||||||
|
|
||||||
<div class="book-summary">
|
<div class="book-summary">
|
||||||
<div class="book-search">
|
<div class="book-search">
|
||||||
<input type="text" placeholder="{% i18n "SEARCH_PLACEHOLDER" %}Type to search{% endi18n %}" class="form-control" />
|
<input type="text" placeholder="{{ __("SEARCH_PLACEHOLDER") }}" class="form-control" />
|
||||||
</div>
|
</div>
|
||||||
<ul class="summary">
|
<ul class="summary">
|
||||||
{% set _divider = false %}
|
{% set _divider = false %}
|
||||||
@@ -55,7 +49,9 @@
|
|||||||
{% if options.links.gitbook != false %}
|
{% if options.links.gitbook != false %}
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">{% i18n "GITBOOK_LINK" %}Published using GitBook{% endi18n %}</a>
|
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||||
|
{{ __("GITBOOK_LINK") }}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{% extends "./layout.html" %}
|
{% extends "./layout.html" %}
|
||||||
|
|
||||||
{% block title %}{{ title }}{% endblock %}
|
{% block title %}{{ __("LANGS_CHOOSE") }} | {{ title }}{% endblock %}
|
||||||
|
|
||||||
{% block style %}
|
{% block style %}
|
||||||
<link rel="stylesheet" href="{{ staticBase }}/style.css">
|
<link rel="stylesheet" href="{{ staticBase }}/style.css">
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="book-langs-index">
|
<div class="book-langs-index">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3>{% i18n "LANGS_CHOOSE" %}Choose a language{% endi18n %}</h3>
|
<h3>{{ __("LANGS_CHOOSE") }}</h3>
|
||||||
|
|
||||||
<ul class="languages">
|
<ul class="languages">
|
||||||
{% for lang in langs %}
|
{% for lang in langs %}
|
||||||
@@ -22,4 +22,4 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block javascript %}{% endblock %}
|
{% block javascript %}{% endblock %}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html lang="{{ language }}" {% if options.direction == "rtl" %}dir="rtl"{% endif %}>
|
<html lang="{{ language }}" {% if options.direction == "rtl" %}dir="rtl"{% endif %}>
|
||||||
{{ htmlSnippet("html:start")|default("")|safe }}
|
{{ htmlSnippet("html:start")|default("", true)|safe }}
|
||||||
<head>
|
<head>
|
||||||
{{ htmlSnippet("head:start")|default("")|safe }}
|
{{ htmlSnippet("head:start")|default("", true)|safe }}
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=11; IE=10; IE=9; IE=8; IE=7; IE=EDGE" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<title>{% block title %}{% endblock %}</title>
|
<title>{% block title %}{% endblock %}</title>
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||||
<meta name="description" content="{% block description %}{% endblock %}">
|
<meta name="description" content="{% block description %}{% endblock %}">
|
||||||
@@ -17,15 +17,15 @@
|
|||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="{{ staticBase }}/images/apple-touch-icon-precomposed-152.png">
|
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="{{ staticBase }}/images/apple-touch-icon-precomposed-152.png">
|
||||||
<link rel="shortcut icon" href="{{ staticBase }}/images/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="{{ staticBase }}/images/favicon.ico" type="image/x-icon">
|
||||||
|
{% block style %}{% endblock %}
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
{{ htmlSnippet("head:end")|default("")|safe }}
|
{{ htmlSnippet("head:end")|default("", true)|safe }}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{ htmlSnippet("body:start")|default("")|safe }}
|
{{ htmlSnippet("body:start")|default("", true)|safe }}
|
||||||
{% block style %}{% endblock %}
|
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
{% block javascript %}{% endblock %}
|
{% block javascript %}{% endblock %}
|
||||||
{{ htmlSnippet("body:end")|default("")|safe }}
|
{{ htmlSnippet("body:end")|default("", true)|safe }}
|
||||||
</body>
|
</body>
|
||||||
{{ htmlSnippet("html:end")|default("")|safe }}
|
{{ htmlSnippet("html:end")|default("", true)|safe }}
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block title %}{% if progress.current.introduction and not progress.current.title %}{% i18n "SUMMARY_INTRODUCTION" %}Introduction{% endi18n %}{% else %}{{ progress.current.title }}{% endif %} | {{ title }}{% endblock %}
|
{% block title %}{{ progress.current.title }} | {{ title }}{% endblock %}
|
||||||
{% block description %}{% if progress.current.level == "0" %}{{ description }}{% endif %}{% endblock %}
|
{% block description %}{% if progress.current.level == "0" %}{{ description }}{% endif %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@@ -70,7 +70,7 @@ require(["gitbook"], function(gitbook) {
|
|||||||
<link rel="stylesheet" href="{{ staticBase }}/plugins/{{ resource.path }}">
|
<link rel="stylesheet" href="{{ staticBase }}/plugins/{{ resource.path }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% for style in styles %}
|
{% for type, style in styles %}
|
||||||
<link rel="stylesheet" href="{{ basePath }}/{{ style }}">
|
<link rel="stylesheet" href="{{ basePath }}/{{ style }}">
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user