Compare commits

...

94 Commits

Author SHA1 Message Date
Johan Preynat 67479a8789 Bump version to 2.6.9 2018-10-11 17:23:42 +02:00
Johan Preynat 7e9f2184e5 Use fork of send for retro-compatibility 2018-10-11 17:23:26 +02:00
Johan Preynat 04d8ada281 Bump version to 2.6.8 2018-10-10 17:35:54 +02:00
Johan Preynat 59a5e87a6e Use fork of i18n compatible with Node 4 and 5 2018-10-10 17:34:16 +02:00
Samy Pessé d8f5aa680d Bump version to 2.6.7 2016-01-13 16:28:09 +01:00
Samy Pessé f2b585e446 Add @egasato as Catalan translator 2016-01-13 16:25:28 +01:00
Samy Pessé 78f91e0037 Merge pull request #1072 from egasato/patch-1
Catalan translation.
2016-01-13 16:24:33 +01:00
Samy Pessé 3f3c156697 Add @turankonan as Turkish translator 2016-01-13 16:24:22 +01:00
Samy Pessé 4627bf5d1f Merge pull request #1075 from turankonan/master
Turkish translation
2016-01-13 16:23:00 +01:00
Samy Pessé 93a144984a Merge pull request #1091 from gitname/gitname-patch-2
Fix typo
2016-01-13 16:22:16 +01:00
Samy Pessé 2d0784440c Fix support for encoded entities in filename 2016-01-13 16:21:52 +01:00
gitname 05a083437f Fix typo 2016-01-09 21:44:30 -08:00
gitname d4b5f59f92 Convert run-on sentence into two sentences 2016-01-09 21:43:49 -08:00
Turan Konan ff53fb6db0 Turkish translation 2016-01-03 22:55:49 +02:00
Esaú García Sánchez-Torija 534b3908cc Catalan translation. 2015-12-30 13:18:43 +01:00
Samy Pessé 7ea2369810 Merge pull request #1066 from hirofumi1987/master
Fixed Japanese translation
2015-12-21 08:40:29 +01:00
hirofumi_i 4d96ec10c1 Fixed Japanese translation 2015-12-21 12:39:19 +09:00
Samy Pesse a37ee3457a Bump version to 2.6.6 2015-12-16 21:02:49 +01:00
Samy Pesse 6969bb9a5c Fix include of css in pdf header/footer 2015-12-16 20:55:06 +01:00
Samy Pessé 4567041456 Bump version to 2.6.5 2015-12-11 14:48:13 +01:00
Samy Pessé 49f09e46da Fix support for local styles 2015-12-11 14:40:20 +01:00
Samy Pessé becd027563 Check style existence on output folder instead of source 2015-12-11 14:31:08 +01:00
Samy Pessé 6eb1605be6 Fix #1041 : fix glossary terms being replaced in script (ex: math) 2015-12-08 15:27:11 +01:00
Samy Pessé 5c16aec096 Use gitbook-markdown-css@1.0.1 2015-12-04 15:43:51 +01:00
Samy Pessé 835e2dc1fb Bump version to 2.6.4 2015-12-02 13:29:04 +01:00
Samy Pessé e2378ab29a Update gitbook-parsers@0.8.9 2015-12-02 13:25:13 +01:00
Samy Pesse 0f1d7eb391 Bump version to 2.6.3 2015-12-02 10:12:49 +01:00
Samy Pesse dd358b8b95 Update gitbook-parsers@0.8.8 2015-12-02 10:11:06 +01:00
Samy Pessé 21cf5fcaf4 Bump version to 2.6.2 2015-11-25 11:56:29 +01:00
Samy Pessé 8c7509759b Update nunjucks@2.2.0 2015-11-25 11:54:19 +01:00
Samy Pessé dc9ac0d0ff Compile js 2015-11-25 11:52:50 +01:00
Samy Pessé 93b401ca9f Add trailing slash to gitbook.state.root, fix value of gitbook.state.bookRoot 2015-11-25 11:49:55 +01:00
Samy Pessé b137d8270a Bump version to 2.6.1 2015-11-25 11:02:15 +01:00
Samy Pessé 6db7757451 Fix gitbook.state.innerLanguage: use camel case 2015-11-25 11:01:17 +01:00
Samy Pessé 43fd42b757 Bump version to 2.6.0 2015-11-25 10:54:09 +01:00
Samy Pessé 5d1c4d2b9f Fix #926: use zh-hans instead of zh-cn and ja instead of jp 2015-11-25 10:52:36 +01:00
Samy Pessé 425acd8bf6 Follow github style: change color of h6 headings 2015-11-25 10:42:36 +01:00
Samy Pessé 414160e0df Merge pull request #1027 from GitbookIO/revert-1020-remove-font-smooth
Revert "Fix small font rendering issue on Macs"
2015-11-25 10:32:28 +01:00
Samy Pessé 117c6aefe8 Revert "Fix small font rendering issue on Macs" 2015-11-25 10:32:17 +01:00
Samy Pessé 13d584d39a Merge pull request #1020 from dylang/remove-font-smooth
Fix small font rendering issue on Macs
2015-11-25 10:28:23 +01:00
Samy Pessé 9bc89c24f5 Fix #1023: close sidebar after clicking a link on mobile 2015-11-25 10:25:58 +01:00
Samy Pessé 5a8c4d5a4e Cleanup lib/generators/json.js 2015-11-25 10:14:34 +01:00
Samy Pessé 98da83a552 Fix urijs dependency on linux 2015-11-25 10:08:24 +01:00
Samy Pessé 5344a30a3b Generate css 2015-11-25 10:05:16 +01:00
Samy Pessé d5d6b3673e Add bookRoot to gitbook.state 2015-11-25 10:05:05 +01:00
Samy Pessé d2a2fe88d1 Update urijs@1.17.0 and tiny-lr 2015-11-25 10:04:44 +01:00
Samy Pesse ced44c86ce Fix #1022: fix bottom margin for lists 2015-11-24 23:38:26 +01:00
Samy Pessé ee402ad444 Merge pull request #1018 from atilacamurca/patch-1
Update README.md
2015-11-19 12:24:42 +01:00
Dylan Greene 3d2155eb66 Make fonts nicer on Macs
Removed the `antialias` setting which tells Chrome to not use native font rendering and instead use something from the late 2010's that isn't subpixel-friendly and looks very blocky. This used to be required when OS X browsers didn't antialias by default because it made fonts look bolder than on Windows. This has since been fixed and we are advised to not use `-webkit-font-smooth`.

https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth
2015-11-17 16:15:33 -05:00
Samy Pessé bd24b03548 Add @buren to AUTHORS 2015-11-16 22:04:41 +01:00
Samy Pessé 5cb55a0f37 Merge pull request #1019 from buren/sv-locale
Add Swedish translation
2015-11-16 22:02:49 +01:00
Jacob Burenstam 163242f80f Add Swedish translation 2015-11-16 22:00:16 +01:00
Átila Camurça Alves 266bfcb8bf Update README.md
There is an extra space in the command line example that enable debug mode.
2015-11-16 16:45:33 -03:00
Samy Pessé d82fa02669 Update plugin-search@1.1.0 2015-11-16 13:09:05 +01:00
Samy Pessé 3a5207a0d2 Merge pull request #1016 from GitbookIO/fix/999
Fix #999: detection of structure should be case incensitive
2015-11-16 10:39:29 +01:00
Samy Pessé e38f3bb884 Improve book.findFile to be case incensitive 2015-11-16 10:31:24 +01:00
Samy Pessé 751cdd9b3b Add test for #999 2015-11-16 10:30:10 +01:00
Samy Pessé 8df6bdca89 Update node version for travis and appveyor tests 2015-11-16 10:18:52 +01:00
Samy Pessé f9df7545ad Merge pull request #1014 from GitbookIO/fix/1013
Fix #1013: prioritize structure defined in book.json
2015-11-16 10:16:52 +01:00
Samy Pessé 9b7a90afef Test first extension of structure itself in book.findFile 2015-11-16 10:06:31 +01:00
Samy Pessé 2ae83b3247 Add failing test for #1013 2015-11-16 09:55:45 +01:00
Samy Pessé 5d907f234e Merge pull request #1005 from mjanda/master
Czech translation
2015-11-07 21:56:28 +01:00
Marek Janda 3a005c4f13 Czech translation 2015-11-07 21:51:27 +01:00
Marek Janda 6c2f50470a Czech translation 2015-11-07 21:00:45 +01:00
Samy Pessé d233783942 Fix bottom margin of blockquote 2015-11-05 11:33:21 +01:00
Samy Pessé 3d9e4c80a2 Bump version to 2.5.2 2015-11-03 09:32:35 +01:00
Samy Pessé a7f49015c1 Fix custom styles for ebook 2015-11-03 09:25:51 +01:00
Samy Pessé 68ed2631dc Correctly show space between toolbar icon and text in buttons 2015-11-02 17:16:43 +01:00
Samy Pessé 2814fea67e Trigger "start" before "page.change" 2015-11-02 16:57:08 +01:00
Samy Pessé 3388be9db6 Update app.js 2015-10-27 23:11:55 +01:00
Samy Pessé 9b89319820 Bump version to 2.5.1 2015-10-27 23:11:31 +01:00
Samy Pessé ad34089df5 Merge changelog for 2.5.0 2015-10-27 23:10:29 +01:00
Samy Pessé 7a4c6bc326 Fix calcul of root in gitbook.state when serving index.html as / 2015-10-27 18:44:04 +01:00
Samy Pessé 6ab386ae35 Bump version to 2.5.0 2015-10-27 13:25:52 +01:00
Samy Pessé 0abbfde912 Add chapterTitle to app build 2015-10-27 12:19:54 +01:00
Samy Pessé 0521defb63 Add 'chapterTitle' to gitbook.state api 2015-10-27 12:18:04 +01:00
Samy Pessé ea4d96610f Compatibility for require of plugins 2015-10-24 21:36:17 +02:00
Samy Pessé 4bc56564b4 Comment gitbook.state api 2015-10-22 16:12:21 +02:00
Samy Pessé 013f7f09da Add gitbook.state.filepath
Fix gitbook.state.root
2015-10-22 16:11:05 +02:00
Samy Pessé f082de1f92 Bump version to 2.5.0-beta.7 2015-10-22 13:52:19 +02:00
Samy Pessé ad39dc8c0c Update app.js 2015-10-22 13:50:05 +02:00
Samy Pessé 481a76319f Provide gitbook.state.root to plugins 2015-10-22 13:49:28 +02:00
Samy Pessé 27a43d5aea Merge pull request #986 from GitbookIO/fix/heading_ids
Normalize ID for headings
2015-10-21 18:05:40 +02:00
Samy Pessé df1d5a0680 Correctly generate id if none found 2015-10-21 17:58:06 +02:00
Samy Pessé 722109faf0 Update gitbook-parsers@0.8.7 2015-10-21 16:22:47 +02:00
Samy Pessé d4dca7736a Update gitbook-parsers@0.8.6 2015-10-21 16:15:56 +02:00
Samy Pessé 4e90becd52 Use Arial as default font 2015-10-21 15:54:45 +02:00
Samy Pessé 26890e94eb Bump version to 2.5.0-beta.6 2015-10-20 18:20:44 +02:00
Samy Pessé 55c83f9a59 Use helvetica by default for pdf 2015-10-20 18:09:51 +02:00
Samy Pessé b837d82878 Fix default style for pdf footer and header 2015-10-20 18:02:23 +02:00
Samy Pessé cbdcdb1e0f Fix #974: correctly handle query in image urls 2015-10-20 17:22:01 +02:00
Samy Pessé 4fea85289e Merge pull request #983 from GitbookIO/fix/982
Fix #982: correctly handle templating in imported content
2015-10-20 17:09:15 +02:00
Samy Pessé ba5f9132c9 Fix #982: fix shortcuts for included templates 2015-10-20 17:08:44 +02:00
Samy Pessé 991681daa2 Add failing test for #982 2015-10-20 16:38:48 +02:00
61 changed files with 2491 additions and 2013 deletions
+1 -2
View File
@@ -1,9 +1,8 @@
sudo: false
language: node_js
node_js:
- "stable"
- "4.1"
- "0.12"
- "0.11"
- "0.10"
before_install:
- npm install svgexport -g
+8
View File
@@ -57,3 +57,11 @@ Translators
- @a-moses
- Ukrainian
- @Karnaukhov
- Czech
- @mjanda
- Swedish
- Jacob Burenstam (@buren)
- Turkish
- Turan Konan (@turankonan)
- Catalan
- Esaú García Sánchez-Torija (@egasato)
+47 -11
View File
@@ -2,21 +2,49 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## 2.5.0-beta.5
- Fix position of sidebar toggle button
- Update asciidoc parser to remove git dependency
## 2.6.7
- Fix bug with filenames including spaces
- Add Turkish and Catalan translations
## 2.5.0-beta.4
- Fix compatibility for some plugins (like `autocover`)
- Fix position of sidebar toggle button when glossary button is present
## 2.6.6
- Fix custom CSS that are generated by plugins for PDF output
## 2.5.0-beta.3
- Fix installation of plugins when using a pre-release
## 2.6.5
- Fix support for plugins generating custom stylesheets (`styles-less` and `styles-sass`)
- Fix glossary terms being replaced in script (ex: math)
## 2.5.0-beta.2
- Fix support for pre-releases
## 2.6.4
- Fix regression introduced by `2.6.3` of single HTML tags in markdown
## 2.5.0-beta.1
## 2.6.3
- Fix parsing bug with inline HTML in Markdown
## 2.6.2
- Fix `gitbook.state.bookRoot`, `gitbook.state.root` now has a trailing slash
- Update nunjucks to 2.2.0
## 2.6.1
- Use CamelCase for `gitbook.state.innerLanguage`
## 2.6.0
- Close sidebar after clicking a link on mobile
- Add root for multilingual books: `gitbook.state.bookRoot`
- Fix color of h6 headings
- Fix bottom margin of lists and blockquotes
- Add Swedish translation (`sv`)
- Add Czech translation (`cs`)
- Fix locale names for `zh-hans` and `jp`
- Update plugin `search` to fix crashes
- Aceept case-incensitive structure files (README, GLOSSARY, etc)
## 2.5.2
- Fix custom stylesheets for ebook generation
- Trigger event `start` before `page.change`
## 2.5.1
- Fix calcul of `gitbook.state.root` when serving HTML index as `/`
## 2.5.0
- Font settings, sharing and search are externalized as default plugins
- Plugins can define a configuration schema in the manifest, this schema will be used to validate configuration during build
- New Node.js API for plugin: `book.formatString(type, content)`
@@ -25,6 +53,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Cleaner table of contents for ebooks
- Support for RTL in ebook's table of contents
- Better colors for mobi (links and code blocks)
- Fix installation of plugins when using a pre-release
- Fix support for pre-releases
- Update asciidoc parser to remove git dependency
- Fix templating in imported content
- Fix querystring in image urls
- Normalize heading IDs like GitHub
- Use Arial as default font for PDFs
- Add `root`, `chapterTitle` and `filepath` to `gitbook.state` JS API
## 2.4.3
- Add ukrainian translation (`uk`)
+2 -2
View File
@@ -8,7 +8,7 @@ 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).
You can publish and host book easily online using [gitbook.com](https://www.gitbook.com), a desktop editor is [also available](https://www.gitbook.com/editor).
You can publish and host books easily online using [gitbook.com](https://www.gitbook.com). A desktop editor is [also available](https://www.gitbook.com/editor).
Check out the [GitBook Community Slack Channel](https://slack.gitbook.com), Stay updated by following [@GitBookIO](https://twitter.com/GitBookIO) on Twitter or [GitBook](https://www.facebook.com/gitbookcom) on Facebook.
@@ -213,7 +213,7 @@ Plugins needed to build a book can be installed using: `gitbook install ./`. You
You can use the options `--log=debug` and `--debug` to get better error messages (with stack trace). For example:
```
$ gitbook build ./ -- log=debug --debug
$ gitbook build ./ --log=debug --debug
```
#### How to use the latest commit from GitBook in gitbook-cli
+2 -2
View File
@@ -5,8 +5,8 @@ init:
# Test against these versions of Node.js.
environment:
matrix:
- nodejs_version: "0.10"
- nodejs_version: "0.11"
- nodejs_version: "0.12"
- nodejs_version: "4.1"
# Install scripts. (runs after repo cloning)
install:
+32 -18
View File
@@ -356,10 +356,10 @@ Book.prototype.parsePlugins = function() {
// Parse readme to extract defaults title and description
Book.prototype.parseReadme = function() {
var that = this;
var structure = that.config.getStructure('readme');
that.log.debug.ln('start parsing readme:', structure);
var filename = that.config.getStructure('readme', true);
that.log.debug.ln('start parsing readme:', filename);
return that.findFile(structure)
return that.findFile(filename)
.then(function(readme) {
if (!readme) throw 'No README file';
if (!_.contains(that.files, readme.path)) throw 'README file is ignored';
@@ -390,10 +390,10 @@ Book.prototype.parseReadme = function() {
Book.prototype.parseLangs = function() {
var that = this;
var structure = that.config.getStructure('langs');
that.log.debug.ln('start parsing languages index:', structure);
var filename = that.config.getStructure('langs', true);
that.log.debug.ln('start parsing languages index:', filename);
return that.findFile(structure)
return that.findFile(filename)
.then(function(langs) {
if (!langs) return [];
@@ -421,10 +421,10 @@ Book.prototype.parseLangs = function() {
Book.prototype.parseSummary = function() {
var that = this;
var structure = that.config.getStructure('summary');
that.log.debug.ln('start parsing summary:', structure);
var filename = that.config.getStructure('summary', true);
that.log.debug.ln('start parsing summary:', filename);
return that.findFile(structure)
return that.findFile(filename)
.then(function(summary) {
if (!summary) throw 'No SUMMARY file';
@@ -459,10 +459,10 @@ Book.prototype.parseSummary = function() {
Book.prototype.parseGlossary = function() {
var that = this;
var structure = that.config.getStructure('glossary');
that.log.debug.ln('start parsing glossary: ', structure);
var filename = that.config.getStructure('glossary', true);
that.log.debug.ln('start parsing glossary: ', filename);
return that.findFile(structure)
return that.findFile(filename)
.then(function(glossary) {
if (!glossary) return [];
@@ -600,19 +600,27 @@ Book.prototype.parsePage = function(filename, options) {
Book.prototype.findFile = function(filename) {
var that = this;
return _.reduce(parsers.extensions, function(prev, ext) {
var ext = path.extname(filename);
var basename = path.basename(filename, ext);
// Ordered list of extensions to test
var exts = parsers.extensions;
if (ext) exts = _.uniq([ext].concat(exts));
return _.reduce(exts, function(prev, ext) {
return prev.then(function(output) {
// Stop if already find a parser
if (output) return output;
var filepath = filename+ext;
var filepath = basename+ext;
return fs.findFile(that.root, filepath)
.then(function(realFilepath) {
if (!realFilepath) return null;
return that.fileExists(filepath)
.then(function(exists) {
if (!exists) return null;
return {
parser: parsers.get(ext),
path: filepath
path: realFilepath
};
});
});
@@ -728,6 +736,12 @@ Book.prototype.resolve = function() {
return pathUtil.resolveInRoot.apply(null, [this.root].concat(_.toArray(arguments)));
};
// Resolve a path in the book output
// Enforce that the output path in the output folder
Book.prototype.resolveOutput = function() {
return pathUtil.resolveInRoot.apply(null, [this.options.output].concat(_.toArray(arguments)));
};
// Convert an abslute path into a relative path to this
Book.prototype.relative = function(p) {
return path.relative(this.root, p);
+2 -1
View File
@@ -75,8 +75,9 @@ module.exports = {
// Add page numbers to the bottom of every page
'pageNumbers': false,
// Font size for the file content
// Font for the file content
'fontSize': 12,
'fontFamily': 'Arial',
// Paper size for the pdf
// 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’]
+6 -2
View File
@@ -181,8 +181,12 @@ Configuration.prototype.dump = function() {
};
// Get structure file
Configuration.prototype.getStructure = function(name) {
return this.options.structure[name].split('.').slice(0, -1).join('.');
Configuration.prototype.getStructure = function(name, dontStripExt) {
var filename = this.options.structure[name];
if (dontStripExt) return filename;
filename = filename.split('.').slice(0, -1).join('.');
return filename;
};
// Return normalized language
+20 -10
View File
@@ -1,15 +1,19 @@
var path = require("path");
var nunjucks = require("nunjucks");
var _ = require('lodash');
var path = require('path');
var nunjucks = require('nunjucks');
var git = require("./utils/git");
var fs = require("./utils/fs");
var pathUtil = require("./utils/path");
var git = require('./utils/git');
var fs = require('./utils/fs');
var pathUtil = require('./utils/path');
// The loader should handle relative and git url
var BookLoader = nunjucks.Loader.extend({
async: true,
init: function(book) {
init: function(book, opts) {
this.opts = _.defaults(opts || {}, {
interpolate: _.identity
});
this.book = book;
},
@@ -20,14 +24,20 @@ var BookLoader = nunjucks.Loader.extend({
.then(function(filepath) {
// Is local file
if (!filepath) filepath = path.resolve(fileurl);
else that.book.log.debug.ln("resolve from git", fileurl, "to", filepath);
else that.book.log.debug.ln('resolve from git', fileurl, 'to', filepath);
// Read file from absolute path
return fs.readFile(filepath)
.then(function(source) {
return that.opts.interpolate(filepath, source.toString());
})
.then(function(source) {
return {
src: source.toString(),
path: filepath
src: source,
path: filepath,
// We disable cache sincde content is modified (shortcuts, ...)
noCache: true
};
});
})
@@ -53,7 +63,7 @@ var BookLoader = nunjucks.Loader.extend({
return path.resolve(path.dirname(from), to);
},
// Handle all files as relative, so that nunjucks pass responsability to "resolve"
// Handle all files as relative, so that nunjucks pass responsability to 'resolve'
// Only git urls are considered as absolute
isRelative: function(filename) {
return !git.checkUrl(filename);
+5 -4
View File
@@ -46,7 +46,7 @@ Generator.prototype.writeSummary = function() {
Generator.prototype.getPDFTemplate = function(id) {
var tpl = this.options.pdf[id+'Template'];
var defaultTpl = path.resolve(this.options.theme, 'templates/ebook/'+id+'.html');
var defaultCSS = path.resolve(this.options.theme, 'assets/pdf.css');
var defaultCSS = path.resolve(this.options.theme, 'assets/ebook/pdf.css');
// Default template from theme
if (!tpl && fs.existsSync(defaultTpl)) {
@@ -63,11 +63,11 @@ Generator.prototype.getPDFTemplate = function(id) {
// Custom PDF style
if (this.styles.pdf) {
stylesheets.push(fs.readFileSync(this.book.resolve(this.styles.pdf), { encoding: 'utf-8' }));
stylesheets.push(fs.readFileSync(this.book.resolveOutput(this.styles.pdf), { encoding: 'utf-8' }));
}
tpl = juice(tpl, {
extraCss: stylesheets.concat('/n')
extraCss: stylesheets.join('\n\n')
});
return tpl;
@@ -123,7 +123,8 @@ Generator.prototype.finish = function() {
'--paper-size': String(pdfOptions.paperSize),
'--pdf-page-numbers': Boolean(pdfOptions.pageNumbers),
'--pdf-header-template': that.getPDFTemplate('header'),
'--pdf-footer-template': that.getPDFTemplate('footer')
'--pdf-footer-template': that.getPDFTemplate('footer'),
'--pdf-sans-family': String(pdfOptions.fontFamily)
});
} else if (that.ebookFormat == 'epub') {
_.extend(_options, {
+10 -10
View File
@@ -1,11 +1,11 @@
var util = require("util");
var path = require("path");
var Q = require("q");
var _ = require("lodash");
var util = require('util');
var path = require('path');
var Q = require('q');
var _ = require('lodash');
var fs = require("../utils/fs");
var BaseGenerator = require("../generator");
var links = require("../utils/links");
var fs = require('../utils/fs');
var BaseGenerator = require('../generator');
var links = require('../utils/links');
var Generator = function() {
BaseGenerator.apply(this, arguments);
@@ -26,7 +26,7 @@ Generator.prototype.convertFile = function(input) {
sections: page.sections
};
var output = links.changeExtension(page.path, ".json");
var output = links.changeExtension(page.path, '.json');
output = path.join(that.options.output, output);
return fs.writeFile(
@@ -51,7 +51,7 @@ Generator.prototype.writeReadme = function() {
langs = that.book.langs;
mainLang = langs.length > 0? _.first(langs).lang : null;
readme = links.changeExtension(that.book.readmeFile, ".json");
readme = links.changeExtension(that.book.readmeFile, '.json');
// Read readme from main language
return fs.readFile(
@@ -67,7 +67,7 @@ Generator.prototype.writeReadme = function() {
// Write it as README.json
return fs.writeFile(
path.join(that.options.output, "README.json"),
path.join(that.options.output, 'README.json'),
JSON.stringify(json, null, 4)
);
});
+7 -1
View File
@@ -49,7 +49,12 @@ Generator.prototype.prepareStyles = function() {
this.styles = _.chain(this.styles)
.map(function(style) {
var stylePath = that.options.styles[style];
if (stylePath && fs.existsSync(that.book.resolve(stylePath))) {
var styleExists = (
fs.existsSync(that.book.resolveOutput(stylePath)) ||
fs.existsSync(that.book.resolve(stylePath))
);
if (stylePath && styleExists) {
return [style, stylePath];
}
return null;
@@ -208,6 +213,7 @@ Generator.prototype._writeTemplate = function(tpl, options, output, interpolate)
title: that.options.title,
description: that.options.description,
language: that.book.config.normalizeLanguage(),
innerlanguage: that.book.isSubBook()? that.book.config.get('language') : null,
glossary: that.book.glossary,
+1 -1
View File
@@ -1,4 +1,4 @@
/*eslint no-console: 0*/
/* eslint no-console: 0 */
var Q = require('q');
var _ = require('lodash');
+60 -34
View File
@@ -1,12 +1,14 @@
var _ = require("lodash");
var Q = require("q");
var nunjucks = require("nunjucks");
var escapeStringRegexp = require("escape-string-regexp");
var _ = require('lodash');
var Q = require('q');
var path = require('path');
var nunjucks = require('nunjucks');
var parsers = require('gitbook-parsers');
var escapeStringRegexp = require('escape-string-regexp');
var batch = require("./utils/batch");
var pkg = require("../package.json");
var defaultBlocks = require("./blocks");
var BookLoader = require("./conrefs_loader");
var batch = require('./utils/batch');
var pkg = require('../package.json');
var defaultBlocks = require('./blocks');
var BookLoader = require('./conrefs_loader');
// Normalize result from a block
function normBlockResult(blk) {
@@ -16,24 +18,37 @@ function normBlockResult(blk) {
var TemplateEngine = function(book) {
var that = this;
this.book = book;
this.log = this.book.log;
// Template loader
this.loader = new BookLoader(book, {
// Replace shortcuts in imported files
interpolate: function(filepath, source) {
var parser = parsers.get(path.extname(filepath));
var type = parser? parser.name : null;
return that.applyShortcuts(type, source);
}
});
// Nunjucks env
this.env = new nunjucks.Environment(
new BookLoader(book),
this.loader,
{
// Escaping is done after by the markdown parser
autoescape: false,
// Tags
tags: {
blockStart: "{%",
blockEnd: "%}",
variableStart: "{{",
variableEnd: "}}",
commentStart: "{###",
commentEnd: "###}"
blockStart: '{%',
blockEnd: '%}',
variableStart: '{{',
variableEnd: '}}',
commentStart: '{###',
commentEnd: '###}'
}
}
);
@@ -60,20 +75,20 @@ TemplateEngine.prototype.processBlock = function(blk) {
parse: false,
post: undefined
});
blk.id = _.uniqueId("blk");
blk.id = _.uniqueId('blk');
var toAdd = (!blk.parse) || (blk.post !== undefined);
// Add to global map
if (toAdd) this.blockBodies[blk.id] = blk;
//Parsable block, just return it
// Parsable block, just return it
if (blk.parse) {
return blk.body;
}
// Return it as a position marker
return "@%@"+blk.id+"@%@";
return '@%@'+blk.id+'@%@';
};
// Replace position markers of blocks by body after processing
@@ -110,11 +125,13 @@ TemplateEngine.prototype.bindContext = function(func) {
TemplateEngine.prototype.addFilter = function(filterName, func) {
try {
this.env.getFilter(filterName);
this.log.warn.ln("conflict in filters, \""+filterName+"\" is already set");
this.log.warn.ln('conflict in filters, \''+filterName+'\' is already set');
return false;
} catch(e) {}
} catch(e) {
// Filter doesn't exist
}
this.log.debug.ln("add filter \""+filterName+"\"");
this.log.debug.ln('add filter \''+filterName+'\'');
this.env.addFilter(filterName, this.bindContext(function() {
var ctx = this;
var args = Array.prototype.slice.apply(arguments);
@@ -138,7 +155,7 @@ TemplateEngine.prototype.addFilters = function(filters) {
// Return nunjucks extension name of a block
TemplateEngine.prototype.blockExtName = function(name) {
return "Block"+name+"Extension";
return 'Block'+name+'Extension';
};
// Test if a block is defined
@@ -167,7 +184,7 @@ TemplateEngine.prototype.addBlock = function(name, block) {
block = _.defaults(block || {}, {
shortcuts: [],
end: "end"+name,
end: 'end'+name,
process: _.identity,
blocks: []
});
@@ -175,13 +192,13 @@ TemplateEngine.prototype.addBlock = function(name, block) {
extName = this.blockExtName(name);
if (this.hasBlock(name) && !defaultBlocks[name]) {
this.log.warn.ln("conflict in blocks, \""+name+"\" is already defined");
this.log.warn.ln('conflict in blocks, \''+name+'\' is already defined');
}
// Cleanup previous block
this.removeBlock(name);
this.log.debug.ln("add block \""+name+"\"");
this.log.debug.ln('add block \''+name+'\'');
this.blocks[name] = block;
Ext = function () {
@@ -238,7 +255,7 @@ TemplateEngine.prototype.addBlock = function(name, block) {
bodies.push(subbodies[blockName][0].body);
});
return new nodes.CallExtensionAsync(this, "run", args, bodies);
return new nodes.CallExtensionAsync(this, 'run', args, bodies);
};
this.run = function(context) {
@@ -287,7 +304,7 @@ TemplateEngine.prototype.addBlock = function(name, block) {
// Add shortcuts
if (!_.isArray(block.shortcuts)) block.shortcuts = [block.shortcuts];
_.each(block.shortcuts, function(shortcut) {
this.log.debug.ln("add template shortcut from \""+shortcut.start+"\" to block \""+name+"\" for parsers ", shortcut.parsers);
this.log.debug.ln('add template shortcut from \''+shortcut.start+'\' to block \''+name+'\' for parsers ', shortcut.parsers);
this.shortcuts.push({
block: name,
parsers: shortcut.parsers,
@@ -314,7 +331,7 @@ TemplateEngine.prototype.applyBlock = function(name, blk, ctx) {
var func, block, r;
block = this.blocks[name];
if (!block) throw new Error("Block not found \""+name+"\"");
if (!block) throw new Error('Block not found \''+name+'\'');
if (_.isString(blk)) {
blk = {
body: blk
@@ -339,14 +356,19 @@ TemplateEngine.prototype.applyBlock = function(name, blk, ctx) {
TemplateEngine.prototype._applyShortcut = function(parser, content, shortcut) {
if (!_.contains(shortcut.parsers, parser)) return content;
var regex = new RegExp(
escapeStringRegexp(shortcut.start) + "([\\s\\S]*?[^\\$])" + escapeStringRegexp(shortcut.end),
"g"
escapeStringRegexp(shortcut.start) + '([\\s\\S]*?[^\\$])' + escapeStringRegexp(shortcut.end),
'g'
);
return content.replace(regex, function(all, match) {
return "{% "+shortcut.tag.start+" %}"+ match + "{% "+shortcut.tag.end+" %}";
return '{% '+shortcut.tag.start+' %}'+ match + '{% '+shortcut.tag.end+' %}';
});
};
// Apply all shortcuts to some template string
TemplateEngine.prototype.applyShortcuts = function(type, content) {
return _.reduce(this.shortcuts, _.partial(this._applyShortcut.bind(this), type), content);
};
// Render a string from the book
TemplateEngine.prototype.renderString = function(content, context, options) {
context = _.extend({}, context, {
@@ -367,14 +389,18 @@ TemplateEngine.prototype.renderString = function(content, context, options) {
type: null
});
if (options.path) options.path = this.book.resolve(options.path);
if (!options.type && options.path) {
var parser = parsers.get(path.extname(options.path));
options.type = parser? parser.name : null;
}
// Replace shortcuts
content = _.reduce(this.shortcuts, _.partial(this._applyShortcut.bind(this), options.type), content);
content = this.applyShortcuts(options.type, content);
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: /, "");
err.message = err.message.replace(/^Error: /, '');
throw err;
});
@@ -398,7 +424,7 @@ TemplateEngine.prototype.renderPage = function(page) {
return that.book.statFile(page.path)
.then(function(stat) {
var context = {
var context = {
// infos about the file
file: {
path: page.path,
+12
View File
@@ -30,6 +30,7 @@ var fsUtils = {
fs.exists(path, d.resolve);
return d.promise;
},
findFile: findFile,
existsSync: fs.existsSync.bind(fs),
readFileSync: fs.readFileSync.bind(fs),
clean: cleanFolder,
@@ -178,4 +179,15 @@ function cleanFolder(root) {
});
}
// Find a file in a folder (case incensitive)
// Return the real filename
function findFile(root, filename) {
return Q.nfcall(fs.readdir, root)
.then(function(files) {
return _.find(files, function(file) {
return (file.toLowerCase() == filename.toLowerCase());
});
});
}
module.exports = fsUtils;
+19 -19
View File
@@ -1,14 +1,14 @@
var Q = require("q");
var _ = require("lodash");
var path = require("path");
var crc = require("crc");
var exec = Q.denodeify(require("child_process").exec);
var URI = require("URIjs");
var pathUtil = require("./path");
var Q = require('q');
var _ = require('lodash');
var path = require('path');
var crc = require('crc');
var exec = Q.denodeify(require('child_process').exec);
var URI = require('urijs');
var pathUtil = require('./path');
var fs = require("./fs");
var fs = require('./fs');
var GIT_PREFIX = "git+";
var GIT_PREFIX = 'git+';
var GIT_TMP = null;
@@ -30,20 +30,20 @@ function parseGitUrl(giturl) {
giturl = giturl.slice(GIT_PREFIX.length);
uri = new URI(giturl);
ref = uri.fragment() || "master";
ref = uri.fragment() || 'master';
uri.fragment(null);
// Extract file inside the repo (after the .git)
fileParts =uri.path().split(".git");
filepath = fileParts.length > 1? fileParts.slice(1).join(".git") : "";
if (filepath[0] == "/") filepath = filepath.slice(1);
fileParts =uri.path().split('.git');
filepath = fileParts.length > 1? fileParts.slice(1).join('.git') : '';
if (filepath[0] == '/') filepath = filepath.slice(1);
// Recreate pathname without the real filename
uri.path(_.first(fileParts)+".git");
uri.path(_.first(fileParts)+'.git');
return {
host: uri.toString(),
ref: ref || "master",
ref: ref || 'master',
filepath: filepath
};
}
@@ -52,7 +52,7 @@ function parseGitUrl(giturl) {
function cloneGitRepo(host, ref) {
var isBranch = false;
ref = ref || "master";
ref = ref || 'master';
if (!validateSha(ref)) isBranch = true;
return Q()
@@ -69,7 +69,7 @@ function cloneGitRepo(host, ref) {
// Return or clone the git repo
.then(function() {
// Unique ID for repo/ref combinaison
var repoId = crc.crc32(host+"#"+ref).toString(16);
var repoId = crc.crc32(host+'#'+ref).toString(16);
// Absolute path to the folder
var repoPath = path.resolve(GIT_TMP, repoId);
@@ -79,9 +79,9 @@ function cloneGitRepo(host, ref) {
if (doExists) return;
// Clone repo
return exec("git clone "+host+" "+repoPath)
return exec('git clone '+host+' '+repoPath)
.then(function() {
return exec("git checkout "+ref, { cwd: repoPath });
return exec('git checkout '+ref, { cwd: repoPath });
});
})
.thenResolve(repoPath);
+13 -13
View File
@@ -1,13 +1,13 @@
var _ = require("lodash");
var path = require("path");
var fs = require("fs");
var _ = require('lodash');
var path = require('path');
var fs = require('fs');
var i18n = require("i18n");
var i18n = require('i18n');
var I18N_PATH = path.resolve(__dirname, "../../theme/i18n/");
var DEFAULT_LANGUAGE = "en";
var I18N_PATH = path.resolve(__dirname, '../../theme/i18n/');
var DEFAULT_LANGUAGE = 'en';
var LOCALES = _.map(fs.readdirSync(I18N_PATH), function(lang) {
return path.basename(lang, ".json");
return path.basename(lang, '.json');
});
i18n.configure({
@@ -18,11 +18,11 @@ i18n.configure({
});
function compareLocales(lang, locale) {
var langMain = _.first(lang.split("-"));
var langSecond = _.last(lang.split("-"));
var langMain = _.first(lang.split('-'));
var langSecond = _.last(lang.split('-'));
var localeMain = _.first(locale.split("-"));
var localeSecond = _.last(locale.split("-"));
var localeMain = _.first(locale.split('-'));
var localeSecond = _.last(locale.split('-'));
if (locale == lang) return 100;
if (localeMain == langMain) return 50;
@@ -42,8 +42,8 @@ var normalizeLanguage = _.memoize(function(lang) {
.filter(function(lang) {
return lang.score > 0;
})
.sortBy("score")
.pluck("locale")
.sortBy('score')
.pluck('locale')
.last()
.value();
return language || lang;
+26 -27
View File
@@ -1,51 +1,50 @@
var url = require("url");
var path = require("path");
var url = require('url');
var path = require('path');
// Is the link an external link
var isExternal = function(href) {
function isExternal(href) {
try {
return Boolean(url.parse(href).protocol);
} catch(err) { }
return false;
};
} catch(err) {
return false;
}
}
// Return true if the link is relative
var isRelative = function(href) {
function isRelative(href) {
try {
var parsed = url.parse(href);
return !!(!parsed.protocol && parsed.path);
} catch(err) {}
return true;
};
} catch(err) {
return true;
}
}
// Return true if the link is an achor
var isAnchor = function(href) {
function isAnchor(href) {
try {
var parsed = url.parse(href);
return !!(!parsed.protocol && !parsed.path && parsed.hash);
} catch(err) {}
return false;
};
} catch(err) {
return false;
}
}
// Normalize a path to be a link
var normalizeLink = function(s) {
return s.replace(/\\/g, "/");
};
function normalizeLink(s) {
return s.replace(/\\/g, '/');
}
// Relative to absolute path
// dir: directory parent of the file currently in rendering process
// outdir: directory parent from the html output
var toAbsolute = function(_href, dir, outdir) {
function toAbsolute(_href, dir, outdir) {
if (isExternal(_href)) return _href;
// Path "_href" inside the base folder
var hrefInRoot = path.normalize(path.join(dir, _href));
if (_href[0] == "/") hrefInRoot = path.normalize(_href.slice(1));
if (_href[0] == '/') hrefInRoot = path.normalize(_href.slice(1));
// Make it relative to output
_href = path.relative(outdir, hrefInRoot);
@@ -54,22 +53,22 @@ var toAbsolute = function(_href, dir, outdir) {
_href = normalizeLink(_href);
return _href;
};
}
// Join links
var join = function() {
function join() {
var _href = path.join.apply(path, arguments);
return normalizeLink(_href);
};
// Change extension
var changeExtension = function(filename, newext) {
function changeExtension(filename, newext) {
return path.join(
path.dirname(filename),
path.basename(filename, path.extname(filename))+newext
);
};
}
module.exports = {
isAnchor: isAnchor,
+19 -8
View File
@@ -6,6 +6,7 @@ var cheerio = require('cheerio');
var domSerializer = require('dom-serializer');
var request = require('request');
var crc = require('crc');
var slug = require('github-slugid');
var links = require('./links');
var imgUtils = require('./images');
@@ -14,18 +15,18 @@ var batch = require('./batch');
var parsableExtensions = require('gitbook-parsers').extensions;
// Map of images that have been converted
var imgConversionCache = {};
// Render a cheerio dom as html
var renderDom = function($, dom, options) {
function renderDom($, dom, options) {
if (!dom && $._root && $._root.children) {
dom = $._root.children;
}
options = options|| dom.options || $._options;
return domSerializer(dom, options);
};
// Map of images that have been converted
var imgConversionCache = {};
}
function replaceText($, el, search, replace, text_only ) {
return $(el).each(function(){
@@ -114,6 +115,13 @@ function normalizeHtml(src, options) {
});
}
// Generate ID for headings
$('h1,h2,h3,h4,h5,h6').each(function() {
if ($(this).attr('id')) return;
$(this).attr('id', slug($(this).text()));
});
// Find images to normalize
$('img').each(function() {
var origin;
@@ -132,7 +140,7 @@ function normalizeHtml(src, options) {
// If image is external and ebook, then downlaod the images
if (isExternal) {
origin = src;
src = '/'+crc.crc32(origin).toString(16)+path.extname(origin);
src = '/'+crc.crc32(origin).toString(16)+path.extname(url.parse(origin).pathname);
src = links.toAbsolute(src, options.base, options.output);
isExternal = false;
}
@@ -197,9 +205,12 @@ function normalizeHtml(src, options) {
// Keep it as it is
} else if (links.isRelative(href)) {
var parts = url.parse(href);
var absolutePath = links.join(options.base, parts.pathname);
var pathName = decodeURIComponent(parts.pathname);
var anchor = parts.hash || '';
// Calcul absolute path for this file (without the anchor)
var absolutePath = links.join(options.base, pathName);
// If is in navigation relative: transform as content
if (options.navigation[absolutePath]) {
@@ -266,7 +277,7 @@ function normalizeHtml(src, options) {
$('*').each(function() {
// Ignore codeblocks
if (_.contains(['code', 'pre', 'a'], this.name.toLowerCase())) return;
if (_.contains(['code', 'pre', 'a', 'script'], this.name.toLowerCase())) return;
replaceText($, this, r, function(match) {
// Add to files index in glossary
+1 -1
View File
@@ -1,4 +1,4 @@
var _ = require("lodash");
var _ = require('lodash');
// Returns from a navigation and a current file, a snapshot of current detailed state
function calculProgress(navigation, current) {
+12 -10
View File
@@ -1,6 +1,6 @@
{
"name": "gitbook",
"version": "2.5.0-beta.5",
"version": "2.6.9",
"homepage": "https://www.gitbook.com",
"description": "Library and cmd utility to generate GitBooks",
"main": "lib/index.js",
@@ -11,26 +11,26 @@
"resolve": "0.6.3",
"fs-extra": "0.16.5",
"fstream-ignore": "1.0.2",
"gitbook-parsers": "0.8.5",
"gitbook-parsers": "0.8.9",
"gitbook-plugin-highlight": "1.0.3",
"gitbook-plugin-sharing": "1.0.1",
"gitbook-plugin-search": "1.0.2",
"gitbook-plugin-search": "1.1.0",
"gitbook-plugin-fontsettings": "1.0.2",
"nunjucks": "2.1.0",
"nunjucks": "2.2.0",
"nunjucks-autoescape": "1.0.0",
"nunjucks-filter": "1.0.0",
"i18n": "0.5.0",
"i18n": "GitbookIO/i18n-node#f26fbfa6b1d7a3bb086ff7849ca262f58a30255b",
"semver": "5.0.1",
"npmi": "0.1.1",
"cheerio": "0.19.0",
"gitbook-plugin-livereload": "0.0.1",
"chokidar": "~1.0.5",
"send": "0.2.0",
"tiny-lr": "0.1.5",
"send": "GitbookIO/send#9081de9cb0fc85d60e871685f252c98db764cb55",
"tiny-lr": "0.2.1",
"tmp": "0.0.24",
"crc": "3.2.1",
"bash-color": "0.0.3",
"URIjs": "1.14.1",
"urijs": "1.17.0",
"request": "2.51.0",
"npm": "2.4.1",
"dom-serializer": "0.1.0",
@@ -39,7 +39,8 @@
"juice": "1.5.0",
"jsonschema": "1.0.2",
"json-schema-defaults": "0.1.1",
"merge-defaults": "0.2.1"
"merge-defaults": "0.2.1",
"github-slugid": "1.0.0"
},
"devDependencies": {
"eslint": "1.5.0",
@@ -57,7 +58,8 @@
"vinyl-source-stream": "1.1.0",
"jquery": "2.1.4",
"mousetrap": "1.5.3",
"font-awesome": "4.1.0"
"font-awesome": "4.1.0",
"gitbook-markdown-css": "1.0.1"
},
"scripts": {
"test": "node_modules/.bin/mocha --reporter spec --timeout 15000"
+3
View File
@@ -1,5 +1,8 @@
# Readme
<p id="test-plugin-block-shortcuts-1">$$test_block1$$</p>
<p id="test-plugin-block-shortcuts-2">{% include "./block.md" %}</p>
### Relative
<p id="t1">{% include "./hello.md" %}</p>
+1
View File
@@ -0,0 +1 @@
$$test_block2$$
+3
View File
@@ -0,0 +1,3 @@
# Hello World
## Hello {#hello-custom}
View File
+1
View File
@@ -0,0 +1 @@
== Readme for the bookk
+1
View File
@@ -0,0 +1 @@
# Readme for GitHub
+1
View File
@@ -0,0 +1 @@
# Summary
+5
View File
@@ -0,0 +1,5 @@
{
"structure": {
"readme": "README.adoc"
}
}
+5
View File
@@ -0,0 +1,5 @@
# Glossary
### Hello
Hello world
+22 -22
View File
@@ -1,63 +1,63 @@
var path = require("path");
var fs = require("fs");
var path = require('path');
var fs = require('fs');
var Plugin = require("../lib/plugin");
var PLUGINS_ROOT = path.resolve(__dirname, "plugins");
var Plugin = require('../lib/plugin');
var PLUGINS_ROOT = path.resolve(__dirname, 'plugins');
describe("Code Highlighting", function () {
describe('Code Highlighting', function () {
var book, PAGE;
before(function() {
return books.generate("highlight", "website", {
return books.generate('highlight', 'website', {
prepare: function(_book) {
book = _book;
var plugin = new Plugin(book, "replace_highlight");
plugin.load("./replace_highlight", PLUGINS_ROOT);
var plugin = new Plugin(book, 'replace_highlight');
plugin.load('./replace_highlight', PLUGINS_ROOT);
book.plugins.load(plugin);
}
})
.then(function() {
PAGE = fs.readFileSync(
path.join(book.options.output, "index.html"),
{ encoding: "utf-8" }
path.join(book.options.output, 'index.html'),
{ encoding: 'utf-8' }
);
});
});
it("should correctly replace highlighting", function() {
it('should correctly replace highlighting', function() {
PAGE.should.be.html({
"code": {
'code': {
index: 0,
text: "code_test 1\n_code"
text: 'code_test 1\n_code'
}
});
});
it("should correctly replace highlighting with language", function() {
it('should correctly replace highlighting with language', function() {
PAGE.should.be.html({
"code": {
'code': {
index: 1,
text: "lang_test 2\n_lang"
text: 'lang_test 2\n_lang'
}
});
});
it("should correctly replace highlighting for inline code", function() {
it('should correctly replace highlighting for inline code', function() {
PAGE.should.be.html({
"code": {
'code': {
index: 2,
text: "code_test 3_code"
text: 'code_test 3_code'
}
});
});
it("should correctly replace highlighting for inline code with html tags", function() {
it('should correctly replace highlighting for inline code with html tags', function() {
PAGE.should.be.html({
"code": {
'code': {
index: 3,
text: "code_<test>_code"
text: 'code_<test>_code'
}
});
});
+21 -21
View File
@@ -1,66 +1,66 @@
var fs = require("fs");
var path = require("path");
var fs = require('fs');
var path = require('path');
describe("ConRefs", function () {
describe('ConRefs', function () {
var book, readme;
before(function() {
return books.generate("conrefs", "website")
return books.generate('conrefs', 'website')
.then(function(_book) {
book = _book;
readme = fs.readFileSync(
path.join(book.options.output, "index.html"),
{ encoding: "utf-8" }
path.join(book.options.output, 'index.html'),
{ encoding: 'utf-8' }
);
});
});
it("should handle local references", function() {
it('should handle local references', function() {
readme.should.be.html({
".page-inner p#t1": {
'.page-inner p#t1': {
count: 1,
text: "Hello World",
text: 'Hello World',
trim: true
}
});
});
it("should handle local references with absolute paths", function() {
it('should handle local references with absolute paths', function() {
readme.should.be.html({
".page-inner p#t2": {
'.page-inner p#t2': {
count: 1,
text: "Hello World",
text: 'Hello World',
trim: true
}
});
});
it("should correctly include file from git reference", function() {
it('should correctly include file from git reference', function() {
readme.should.be.html({
".page-inner p#t3": {
'.page-inner p#t3': {
count: 1,
text: "Hello from git",
text: 'Hello from git',
trim: true
}
});
});
it("should correctly handle deep include in git reference", function() {
it('should correctly handle deep include in git reference', function() {
readme.should.be.html({
".page-inner p#t4": {
'.page-inner p#t4': {
count: 1,
text: "First Hello. Hello from git",
text: 'First Hello. Hello from git',
trim: true
}
});
});
it("should correctly handle absolute include in git reference", function() {
it('should correctly handle absolute include in git reference', function() {
readme.should.be.html({
".page-inner p#t5": {
'.page-inner p#t5': {
count: 1,
text: "First Hello. Hello from git",
text: 'First Hello. Hello from git',
trim: true
}
});
+5 -5
View File
@@ -36,6 +36,11 @@ describe('eBook generator', function () {
});
});
it('should correctly copy print.css', function() {
book.should.have.file('styles');
book.should.have.file('styles/print.css');
});
it('should remove default print.css', function() {
var PAGE = fs.readFileSync(
path.join(book.options.output, 'index.html'),
@@ -61,10 +66,5 @@ describe('eBook generator', function () {
}
});
});
it('should correctly copy print.css', function() {
book.should.have.file('styles');
book.should.have.file('styles/print.css');
});
});
});
+37
View File
@@ -0,0 +1,37 @@
var path = require('path');
var fs = require('fs');
describe('Headings', function () {
var book, PAGE;
before(function() {
return books.generate('headings', 'website')
.then(function(_book) {
book = _book;
PAGE = fs.readFileSync(
path.join(book.options.output, 'index.html'),
{ encoding: 'utf-8' }
);
});
});
describe('IDs', function() {
it('should correctly generate an ID', function() {
PAGE.should.be.html({
'h1#hello-world': {
count: 1
}
});
});
it('should correctly accept custom ID', function() {
PAGE.should.be.html({
'h2#hello-custom': {
count: 1
}
});
});
});
});
+23 -17
View File
@@ -1,13 +1,13 @@
var os = require("os");
var path = require("path");
var Q = require("q");
var _ = require("lodash");
var os = require('os');
var path = require('path');
var Q = require('q');
var _ = require('lodash');
var fsUtil = require("../lib/utils/fs");
var Book = require("../").Book;
var LOG_LEVELS = require("../").LOG_LEVELS;
var fsUtil = require('../lib/utils/fs');
var Book = require('../').Book;
var LOG_LEVELS = require('../').LOG_LEVELS;
require("./assertions");
require('./assertions');
var BOOKS = {};
@@ -20,7 +20,7 @@ function generateBook(bookId, test, opts) {
prepare: function() {}
});
return parseBook(bookId, test)
return parseBook(bookId, test, opts)
.then(function(book) {
return Q(opts.prepare(book))
@@ -32,21 +32,27 @@ function generateBook(bookId, test, opts) {
}
// Generate and return a book
function parseBook(bookId, test) {
test = test || "website";
BOOKS[bookId] = BOOKS[bookId] || {};
if (BOOKS[bookId][test]) return Q(BOOKS[bookId][test]);
function parseBook(bookId, test, opts) {
opts = _.defaults(opts || {}, {
testId: ''
});
BOOKS[bookId][test] = new Book(path.resolve(__dirname, "books", bookId), {
test = test || 'website';
var testId = [test, opts.testId].join('-');
BOOKS[bookId] = BOOKS[bookId] || {};
if (BOOKS[bookId][testId]) return Q(BOOKS[bookId][testId]);
BOOKS[bookId][testId] = new Book(path.resolve(__dirname, 'books', bookId), {
logLevel: LOG_LEVELS.DISABLED,
config: {
output: path.resolve(TMPDIR, bookId+"-"+test)
output: path.resolve(TMPDIR, bookId+'-'+testId)
}
});
return BOOKS[bookId][test].parse()
return BOOKS[bookId][testId].parse()
.then(function() {
return BOOKS[bookId][test];
return BOOKS[bookId][testId];
});
}
+37 -37
View File
@@ -1,91 +1,91 @@
var fs = require("fs");
var path = require("path");
var fs = require('fs');
var path = require('path');
describe("JSON generator", function () {
describe("Basic Book", function() {
describe('JSON generator', function () {
describe('Basic Book', function() {
var book;
before(function() {
return books.generate("basic", "json")
return books.generate('basic', 'json')
.then(function(_book) {
book = _book;
});
});
it("should correctly output a README.json", function() {
book.should.have.file("README.json");
it('should correctly output a README.json', function() {
book.should.have.file('README.json');
});
it("should output a valid json", function() {
book.should.have.jsonfile("README.json");
it('should output a valid json', function() {
book.should.have.jsonfile('README.json');
});
describe("Page Format", function() {
describe('Page Format', function() {
var page;
before(function() {
page = JSON.parse(
fs.readFileSync(
path.join(book.options.output, "README.json"),
{ encoding: "utf-8" }
path.join(book.options.output, 'README.json'),
{ encoding: 'utf-8' }
)
);
});
it("should contains valid section", function() {
page.should.have.property("sections").with.lengthOf(1);
page.sections[0].should.have.property("content").which.is.a.String();
page.sections[0].should.have.property("type", "normal");
it('should contains valid section', function() {
page.should.have.property('sections').with.lengthOf(1);
page.sections[0].should.have.property('content').which.is.a.String();
page.sections[0].should.have.property('type', 'normal');
});
it("should contains valid progress", function() {
page.should.have.property("progress");
page.progress.should.have.property("chapters").with.lengthOf(1);
page.progress.should.have.property("current");
it('should contains valid progress', function() {
page.should.have.property('progress');
page.progress.should.have.property('chapters').with.lengthOf(1);
page.progress.should.have.property('current');
});
it("should contains no languages", function() {
page.should.have.property("langs").with.lengthOf(0);
it('should contains no languages', function() {
page.should.have.property('langs').with.lengthOf(0);
});
});
});
describe("Multilingual Book", function() {
describe('Multilingual Book', function() {
var book;
before(function() {
return books.generate("languages", "json")
return books.generate('languages', 'json')
.then(function(_book) {
book = _book;
});
});
it("should correctly output READMEs", function() {
book.should.have.file("README.json");
book.should.have.file("en/README.json");
book.should.have.file("fr/README.json");
it('should correctly output READMEs', function() {
book.should.have.file('README.json');
book.should.have.file('en/README.json');
book.should.have.file('fr/README.json');
});
it("should output valid json", function() {
book.should.have.jsonfile("README.json");
book.should.have.jsonfile("en/README.json");
book.should.have.jsonfile("fr/README.json");
it('should output valid json', function() {
book.should.have.jsonfile('README.json');
book.should.have.jsonfile('en/README.json');
book.should.have.jsonfile('fr/README.json');
});
describe("Page Format", function() {
describe('Page Format', function() {
var page;
before(function() {
page = JSON.parse(
fs.readFileSync(
path.join(book.options.output, "README.json"),
{ encoding: "utf-8" }
path.join(book.options.output, 'README.json'),
{ encoding: 'utf-8' }
)
);
});
it("should contains no languages", function() {
page.should.have.property("langs").with.lengthOf(2);
it('should contains no languages', function() {
page.should.have.property('langs').with.lengthOf(2);
});
});
});
+41 -6
View File
@@ -1,4 +1,5 @@
var _ = require('lodash');
var fs = require('fs');
var should = require('should');
var path = require('path');
@@ -193,15 +194,49 @@ describe('Plugins', function () {
});
});
it('should correctly accept shortcuts', function() {
return testTpl('$$hello$$', {}, {
type: 'markdown'
})
.then(function(content) {
content.should.equal('testhellotest');
describe('Shortcuts', function() {
it('should correctly accept shortcuts', function() {
return testTpl('$$hello$$', {}, {
type: 'markdown'
})
.then(function(content) {
content.should.equal('testhellotest');
});
});
it('should correctly apply shortcuts to included file', function() {
return books.generate('conrefs', 'website', {
testId: 'include-plugins',
prepare: function(bookConref) {
plugin = new Plugin(bookConref, 'blocks');
plugin.load('./blocks', PLUGINS_ROOT);
return bookConref.plugins.load(plugin);
}
})
.then(function(bookConref) {
var readme = fs.readFileSync(
path.join(bookConref.options.output, 'index.html'),
{ encoding: 'utf-8' }
);
readme.should.be.html({
'.page-inner p#test-plugin-block-shortcuts-1': {
count: 1,
text: 'testtest_block1test',
trim: true
},
'.page-inner p#test-plugin-block-shortcuts-2': {
count: 1,
text: 'testtest_block2test',
trim: true
}
});
});
});
});
it('should correctly extend template blocks with defined end', function() {
return testTpl('{% test2 %}hello{% endtest2end %}')
.then(function(content) {
+20
View File
@@ -0,0 +1,20 @@
describe('Structure', function () {
var book;
before(function() {
return books.parse('structure')
.then(function(_book) {
book = _book;
});
});
it('should prioritize structure defined in book.json', function() {
book.readmeFile.should.equal('README.adoc');
});
it('should be case incensitive', function() {
book.glossaryFile.should.equal('glossary.md');
book.glossary.should.have.lengthOf(1);
});
});
+1 -1
View File
@@ -1 +1 @@
.section.glossary>h1,.section.toc>h1{text-align:center}.page .section b,.page .section dl dt,.page .section strong,.page .section table th{font-weight:700}.link-inherit,.link-inherit:focus,.link-inherit:hover{color:inherit}.hidden{display:none}.section.toc>ol{margin:0;padding:0}.section.toc li{list-style:none}.section.toc li .inner{display:block;border-bottom:1px dotted #eee;margin-bottom:4px}.section.toc li .inner a,.section.toc li .inner span{padding-right:5px;border-bottom:1px solid #fff;margin-bottom:-1px}.section.toc li .inner .page{float:right;padding-left:5px}.section.toc li ol{margin:0;padding:0 0 0 2em}.dir-rtl .section.toc li .inner .page{float:left}.dir-rtl .section.toc li ol{margin:0;padding:0 2em 0 0}.section.glossary .glossary-entry{margin-bottom:40px}.section.glossary .glossary-entry h2 a,.section.glossary .glossary-entry h2 a:hover{color:inherit;text-decoration:none}.section.glossary .glossary-entry .glossary-index{list-style:none;margin:0;padding:0}.section.glossary .glossary-entry .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}body{font-family:sans-serif;color:#000;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.page .section{display:block;word-wrap:break-word;overflow:hidden;color:#000;line-height:1.6}.page .section *{-moz-box-sizing:border-box;box-sizing:border-box}.page .section>:first-child{margin-top:0!important}.page .section>:last-child{margin-bottom:0!important}.page .section blockquote,.page .section code,.page .section figure,.page .section img,.page .section pre,.page .section table,.page .section tr{page-break-inside:avoid}.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section p{orphans:3;widows:3}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5{page-break-after:avoid}.page .section em{font-style:italic}.page .section blockquote,.page .section dl,.page .section ol,.page .section p,.page .section table,.page .section ul{margin-top:0;margin-bottom:.8em}.page .section a{color:#4183c4;text-decoration:none;background:0 0}.page .section a:active,.page .section a:focus,.page .section a:hover{outline:0;text-decoration:underline}.page .section img{border:0;max-width:100%}.page .section hr{height:4px;padding:0;margin:1.6em 0;overflow:hidden;background-color:#e7e7e7;border:none}.page .section hr:after,.page .section hr:before{display:table;content:" "}.page .section hr:after{clear:both}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section h6{margin-top:1.2em;margin-bottom:.8em;font-weight:700}.page .section h1{font-size:2em}.page .section h2{font-size:1.75em}.page .section h3{font-size:1.5em}.page .section h4{font-size:1.25em}.page .section h5,.page .section h6{font-size:1em}.page .section code,.page .section pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;direction:ltr;border:none}.page .section pre{overflow:auto;word-wrap:normal;margin:0 0 1.2em;padding:.85em 1em;background:#f7f7f7}.page .section pre>code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;font-size:.85em;white-space:pre;background:0 0}.page .section pre>code:after,.page .section pre>code:before{content:normal}.page .section code{padding:.2em;margin:0;font-size:.85em;background-color:#f7f7f7}.page .section code:after,.page .section code:before{letter-spacing:-.2em;content:"\00a0"}.page .section table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}.page .section table td,.page .section table th{padding:6px 13px;border:1px solid #ddd}.page .section table tr{background-color:#fff;border-top:1px solid #ccc}.page .section table tr:nth-child(2n){background-color:#f8f8f8}.page .section ol,.page .section ul{padding:0 0 0 2em;margin-top:0;margin-bottom:0}.page .section ol ol,.page .section ol ul,.page .section ul ol,.page .section ul ul{margin-top:0;margin-bottom:0}.page .section ol ol{list-style-type:lower-roman}.page .section blockquote{margin:0;padding:0 15px;color:#858585;border-left:4px solid #e5e5e5}.page .section blockquote:first-child{margin-top:0}.page .section blockquote:last-child{margin-bottom:0}.page .section dl{padding:0}.page .section dl dt{padding:0;margin-top:.8em;font-style:italic}.page .section dl dd{padding:0 .8em;margin-bottom:.8em}.page .section dd{margin-left:0}.page .book-chapter{display:none}
.section.glossary>h1,.section.toc>h1{text-align:center}.page .section b,.page .section dl dt,.page .section strong,.page .section table th{font-weight:700}.link-inherit,.link-inherit:focus,.link-inherit:hover{color:inherit}.hidden{display:none}.section.toc>ol{margin:0;padding:0}.section.toc li{list-style:none}.section.toc li .inner{display:block;border-bottom:1px dotted #eee;margin-bottom:4px}.section.toc li .inner a,.section.toc li .inner span{padding-right:5px;border-bottom:1px solid #fff;margin-bottom:-1px}.section.toc li .inner .page{float:right;padding-left:5px}.section.toc li ol{margin:0;padding:0 0 0 2em}.dir-rtl .section.toc li .inner .page{float:left}.dir-rtl .section.toc li ol{margin:0;padding:0 2em 0 0}.section.glossary .glossary-entry{margin-bottom:40px}.section.glossary .glossary-entry h2 a,.section.glossary .glossary-entry h2 a:hover{color:inherit;text-decoration:none}.page .section,body{color:#000;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.section.glossary .glossary-entry .glossary-index{list-style:none;margin:0;padding:0}.section.glossary .glossary-entry .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}body{font-family:sans-serif}.page .section{display:block;word-wrap:break-word;overflow:hidden;line-height:1.6;-moz-text-size-adjust:100%}.page .section *{box-sizing:border-box;-webkit-box-sizing:border-box;font-size:inherit}.page .section>:first-child{margin-top:0!important}.page .section>:last-child{margin-bottom:0!important}.page .section blockquote,.page .section code,.page .section figure,.page .section img,.page .section pre,.page .section table,.page .section tr{page-break-inside:avoid}.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section p{orphans:3;widows:3}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5{page-break-after:avoid}.page .section em{font-style:italic}.page .section blockquote,.page .section dl,.page .section ol,.page .section p,.page .section table,.page .section ul{margin-top:0;margin-bottom:.8em}.page .section a{color:#4183c4;text-decoration:none;background:0 0}.page .section a:active,.page .section a:focus,.page .section a:hover{outline:0;text-decoration:underline}.page .section img{border:0;max-width:100%}.page .section hr{height:4px;padding:0;margin:1.6em 0;overflow:hidden;background-color:#e7e7e7;border:none}.page .section hr:after,.page .section hr:before{display:table;content:" "}.page .section hr:after{clear:both}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section h6{margin-top:1.2em;margin-bottom:.8em;font-weight:700}.page .section h1{font-size:2em}.page .section h2{font-size:1.75em}.page .section h3{font-size:1.5em}.page .section h4{font-size:1.25em}.page .section h5{font-size:1em}.page .section h6{font-size:1em;color:#777}.page .section code,.page .section pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;direction:ltr;border:none;color:inherit}.page .section pre{overflow:auto;word-wrap:normal;margin:0 0 1.2em;padding:.85em 1em;background:#f7f7f7}.page .section pre>code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;font-size:.85em;white-space:pre;background:0 0}.page .section pre>code:after,.page .section pre>code:before{content:normal}.page .section code{padding:.2em;margin:0;font-size:.85em;background-color:#f7f7f7}.page .section code:after,.page .section code:before{letter-spacing:-.2em;content:"\00a0"}.page .section table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}.page .section table td,.page .section table th{padding:6px 13px;border:1px solid #ddd}.page .section table tr{background-color:#fff;border-top:1px solid #ccc}.page .section table tr:nth-child(2n){background-color:#f8f8f8}.page .section ol,.page .section ul{padding:0 0 0 2em;margin:0 0 .8em}.page .section ol ol,.page .section ol ul,.page .section ul ol,.page .section ul ul{margin-top:0;margin-bottom:0}.page .section ol ol{list-style-type:lower-roman}.page .section blockquote{margin:0 0 .8em;padding:0 15px;color:#858585;border-left:4px solid #e5e5e5}.page .section blockquote:first-child{margin-top:0}.page .section blockquote:last-child{margin-bottom:0}.page .section dl{padding:0}.page .section dl dt{padding:0;margin-top:.8em;font-style:italic}.page .section dl dd{padding:0 .8em;margin-bottom:.8em}.page .section dd{margin-left:0}.page .book-chapter{display:none}
+1 -1
View File
@@ -1 +1 @@
.section.glossary>h1,.section.toc>h1{text-align:center}.page .section b,.page .section dl dt,.page .section strong,.page .section table th{font-weight:700}.link-inherit,.link-inherit:focus,.link-inherit:hover{color:inherit}.hidden{display:none}.section.toc>ol{margin:0;padding:0}.section.toc li{list-style:none}.section.toc li .inner{display:block;border-bottom:1px dotted #eee;margin-bottom:4px}.section.toc li .inner a,.section.toc li .inner span{padding-right:5px;border-bottom:1px solid #fff;margin-bottom:-1px}.section.toc li .inner .page{float:right;padding-left:5px}.section.toc li ol{margin:0;padding:0 0 0 2em}.dir-rtl .section.toc li .inner .page{float:left}.dir-rtl .section.toc li ol{margin:0;padding:0 2em 0 0}.section.glossary .glossary-entry{margin-bottom:40px}.section.glossary .glossary-entry h2 a,.section.glossary .glossary-entry h2 a:hover{color:inherit;text-decoration:none}.section.glossary .glossary-entry .glossary-index{list-style:none;margin:0;padding:0}.section.glossary .glossary-entry .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}body{font-family:serif;color:#000;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.page .section{display:block;word-wrap:break-word;overflow:hidden;color:#000;line-height:1.6}.page .section *{-moz-box-sizing:border-box;box-sizing:border-box}.page .section>:first-child{margin-top:0!important}.page .section>:last-child{margin-bottom:0!important}.page .section blockquote,.page .section code,.page .section figure,.page .section img,.page .section pre,.page .section table,.page .section tr{page-break-inside:avoid}.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section p{orphans:3;widows:3}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5{page-break-after:avoid}.page .section em{font-style:italic}.page .section blockquote,.page .section dl,.page .section ol,.page .section p,.page .section table,.page .section ul{margin-top:0;margin-bottom:.8em}.page .section a{color:#4183c4;text-decoration:none;background:0 0}.page .section a:active,.page .section a:focus,.page .section a:hover{outline:0;text-decoration:underline}.page .section img{border:0;max-width:100%}.page .section hr{height:4px;padding:0;margin:1.6em 0;overflow:hidden;background-color:#e7e7e7;border:none}.page .section hr:after,.page .section hr:before{display:table;content:" "}.page .section hr:after{clear:both}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section h6{margin-top:1.2em;margin-bottom:.8em;font-weight:700}.page .section h1{font-size:2em}.page .section h2{font-size:1.75em}.page .section h3{font-size:1.5em}.page .section h4{font-size:1.25em}.page .section h5,.page .section h6{font-size:1em}.page .section code,.page .section pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;direction:ltr;border:none}.page .section pre{overflow:auto;word-wrap:normal;margin:0 0 1.2em;padding:.85em 1em;background:#f7f7f7}.page .section pre>code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;font-size:.85em;white-space:pre;background:0 0}.page .section pre>code:after,.page .section pre>code:before{content:normal}.page .section code{padding:.2em;margin:0;font-size:.85em;background-color:#f7f7f7}.page .section code:after,.page .section code:before{letter-spacing:-.2em;content:"\00a0"}.page .section table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}.page .section table td,.page .section table th{padding:6px 13px;border:1px solid #ddd}.page .section table tr{background-color:#fff;border-top:1px solid #ccc}.page .section table tr:nth-child(2n){background-color:#f8f8f8}.page .section ol,.page .section ul{padding:0 0 0 2em;margin-top:0;margin-bottom:0}.page .section ol ol,.page .section ol ul,.page .section ul ol,.page .section ul ul{margin-top:0;margin-bottom:0}.page .section ol ol{list-style-type:lower-roman}.page .section blockquote{margin:0;padding:0 15px;color:#858585;border-left:4px solid #e5e5e5}.page .section blockquote:first-child{margin-top:0}.page .section blockquote:last-child{margin-bottom:0}.page .section dl{padding:0}.page .section dl dt{padding:0;margin-top:.8em;font-style:italic}.page .section dl dd{padding:0 .8em;margin-bottom:.8em}.page .section dd{margin-left:0}.page .book-chapter{display:none}
.section.glossary>h1,.section.toc>h1{text-align:center}.page .section b,.page .section dl dt,.page .section strong,.page .section table th{font-weight:700}.link-inherit,.link-inherit:focus,.link-inherit:hover{color:inherit}.hidden{display:none}.section.toc>ol{margin:0;padding:0}.section.toc li{list-style:none}.section.toc li .inner{display:block;border-bottom:1px dotted #eee;margin-bottom:4px}.section.toc li .inner a,.section.toc li .inner span{padding-right:5px;border-bottom:1px solid #fff;margin-bottom:-1px}.section.toc li .inner .page{float:right;padding-left:5px}.section.toc li ol{margin:0;padding:0 0 0 2em}.dir-rtl .section.toc li .inner .page{float:left}.dir-rtl .section.toc li ol{margin:0;padding:0 2em 0 0}.section.glossary .glossary-entry{margin-bottom:40px}.section.glossary .glossary-entry h2 a,.section.glossary .glossary-entry h2 a:hover{color:inherit;text-decoration:none}.page .section,body{color:#000;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.section.glossary .glossary-entry .glossary-index{list-style:none;margin:0;padding:0}.section.glossary .glossary-entry .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}body{font-family:serif}.page .section{display:block;word-wrap:break-word;overflow:hidden;line-height:1.6;-moz-text-size-adjust:100%}.page .section *{box-sizing:border-box;-webkit-box-sizing:border-box;font-size:inherit}.page .section>:first-child{margin-top:0!important}.page .section>:last-child{margin-bottom:0!important}.page .section blockquote,.page .section code,.page .section figure,.page .section img,.page .section pre,.page .section table,.page .section tr{page-break-inside:avoid}.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section p{orphans:3;widows:3}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5{page-break-after:avoid}.page .section em{font-style:italic}.page .section blockquote,.page .section dl,.page .section ol,.page .section p,.page .section table,.page .section ul{margin-top:0;margin-bottom:.8em}.page .section a{color:#4183c4;text-decoration:none;background:0 0}.page .section a:active,.page .section a:focus,.page .section a:hover{outline:0;text-decoration:underline}.page .section img{border:0;max-width:100%}.page .section hr{height:4px;padding:0;margin:1.6em 0;overflow:hidden;background-color:#e7e7e7;border:none}.page .section hr:after,.page .section hr:before{display:table;content:" "}.page .section hr:after{clear:both}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section h6{margin-top:1.2em;margin-bottom:.8em;font-weight:700}.page .section h1{font-size:2em}.page .section h2{font-size:1.75em}.page .section h3{font-size:1.5em}.page .section h4{font-size:1.25em}.page .section h5{font-size:1em}.page .section h6{font-size:1em;color:#777}.page .section code,.page .section pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;direction:ltr;border:none;color:inherit}.page .section pre{overflow:auto;word-wrap:normal;margin:0 0 1.2em;padding:.85em 1em;background:#f7f7f7}.page .section pre>code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;font-size:.85em;white-space:pre;background:0 0}.page .section pre>code:after,.page .section pre>code:before{content:normal}.page .section code{padding:.2em;margin:0;font-size:.85em;background-color:#f7f7f7}.page .section code:after,.page .section code:before{letter-spacing:-.2em;content:"\00a0"}.page .section table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}.page .section table td,.page .section table th{padding:6px 13px;border:1px solid #ddd}.page .section table tr{background-color:#fff;border-top:1px solid #ccc}.page .section table tr:nth-child(2n){background-color:#f8f8f8}.page .section ol,.page .section ul{padding:0 0 0 2em;margin:0 0 .8em}.page .section ol ol,.page .section ol ul,.page .section ul ol,.page .section ul ul{margin-top:0;margin-bottom:0}.page .section ol ol{list-style-type:lower-roman}.page .section blockquote{margin:0 0 .8em;padding:0 15px;color:#858585;border-left:4px solid #e5e5e5}.page .section blockquote:first-child{margin-top:0}.page .section blockquote:last-child{margin-bottom:0}.page .section dl{padding:0}.page .section dl dt{padding:0;margin-top:.8em;font-style:italic}.page .section dl dd{padding:0 .8em;margin-bottom:.8em}.page .section dd{margin-left:0}.page .book-chapter{display:none}
+1 -1
View File
@@ -1 +1 @@
.section.glossary>h1,.section.toc>h1{text-align:center}.page .section b,.page .section dl dt,.page .section strong,.page .section table th{font-weight:700}.link-inherit,.link-inherit:focus,.link-inherit:hover{color:inherit}.hidden{display:none}.section.toc>ol{margin:0;padding:0}.section.toc li{list-style:none}.section.toc li .inner{display:block;border-bottom:1px dotted #eee;margin-bottom:4px}.section.toc li .inner a,.section.toc li .inner span{padding-right:5px;border-bottom:1px solid #fff;margin-bottom:-1px}.section.toc li .inner .page{float:right;padding-left:5px}.section.toc li ol{margin:0;padding:0 0 0 2em}.dir-rtl .section.toc li .inner .page{float:left}.dir-rtl .section.toc li ol{margin:0;padding:0 2em 0 0}.section.glossary .glossary-entry{margin-bottom:40px}.section.glossary .glossary-entry h2 a,.section.glossary .glossary-entry h2 a:hover{color:inherit;text-decoration:none}.section.glossary .glossary-entry .glossary-index{list-style:none;margin:0;padding:0}.section.glossary .glossary-entry .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}body{font-family:serif;color:#000;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.page .section{display:block;word-wrap:break-word;overflow:hidden;color:#000;line-height:1.6}.page .section *{-moz-box-sizing:border-box;box-sizing:border-box}.page .section>:first-child{margin-top:0!important}.page .section>:last-child{margin-bottom:0!important}.page .section blockquote,.page .section code,.page .section figure,.page .section img,.page .section pre,.page .section table,.page .section tr{page-break-inside:avoid}.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section p{orphans:3;widows:3}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5{page-break-after:avoid}.page .section em{font-style:italic}.page .section blockquote,.page .section dl,.page .section ol,.page .section p,.page .section table,.page .section ul{margin-top:0;margin-bottom:.8em}.page .section a{color:#000;text-decoration:none;background:0 0}.page .section a:active,.page .section a:focus,.page .section a:hover{outline:0;text-decoration:underline}.page .section img{border:0;max-width:100%}.page .section hr{height:4px;padding:0;margin:1.6em 0;overflow:hidden;background-color:#e7e7e7;border:none}.page .section hr:after,.page .section hr:before{display:table;content:" "}.page .section hr:after{clear:both}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section h6{margin-top:1.2em;margin-bottom:.8em;font-weight:700}.page .section h1{font-size:2em}.page .section h2{font-size:1.75em}.page .section h3{font-size:1.5em}.page .section h4{font-size:1.25em}.page .section h5,.page .section h6{font-size:1em}.page .section code,.page .section pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;direction:ltr;border:none}.page .section pre{overflow:auto;word-wrap:normal;margin:0 0 1.2em;padding:.85em 1em;background:#f7f7f7}.page .section pre>code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;font-size:.85em;white-space:pre;background:0 0}.page .section pre>code:after,.page .section pre>code:before{content:normal}.page .section code{padding:.2em;margin:0;font-size:.85em;background-color:#f7f7f7}.page .section code:after,.page .section code:before{letter-spacing:-.2em;content:"\00a0"}.page .section table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}.page .book-chapter,.page-toc li .inner span.page{display:none}.page .section table td,.page .section table th{padding:6px 13px;border:1px solid #ddd}.page .section table tr{background-color:#fff;border-top:1px solid #ccc}.page .section table tr:nth-child(2n){background-color:#f8f8f8}.page .section ol,.page .section ul{padding:0 0 0 2em;margin-top:0;margin-bottom:0}.page .section ol ol,.page .section ol ul,.page .section ul ol,.page .section ul ul{margin-top:0;margin-bottom:0}.page .section ol ol{list-style-type:lower-roman}.page .section blockquote{margin:0;padding:0 15px;color:#858585;border-left:4px solid #e5e5e5}.page .section blockquote:first-child{margin-top:0}.page .section blockquote:last-child{margin-bottom:0}.page .section dl{padding:0}.page .section dl dt{padding:0;margin-top:.8em;font-style:italic}.page .section dl dd{padding:0 .8em;margin-bottom:.8em}.page .section dd{margin-left:0}a{color:#000;text-decoration:underline!important}.page-toc li{list-style-type:lower-alpha}.page-toc li .inner{border:none}
.section.glossary>h1,.section.toc>h1{text-align:center}.page .section,body{text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.page .section b,.page .section dl dt,.page .section strong,.page .section table th{font-weight:700}.link-inherit,.link-inherit:focus,.link-inherit:hover{color:inherit}.hidden{display:none}.section.toc>ol{margin:0;padding:0}.section.toc li{list-style:none}.section.toc li .inner{display:block;border-bottom:1px dotted #eee;margin-bottom:4px}.section.toc li .inner a,.section.toc li .inner span{padding-right:5px;border-bottom:1px solid #fff;margin-bottom:-1px}.section.toc li .inner .page{float:right;padding-left:5px}.section.toc li ol{margin:0;padding:0 0 0 2em}.dir-rtl .section.toc li .inner .page{float:left}.dir-rtl .section.toc li ol{margin:0;padding:0 2em 0 0}.section.glossary .glossary-entry{margin-bottom:40px}.section.glossary .glossary-entry h2 a,.section.glossary .glossary-entry h2 a:hover{color:inherit;text-decoration:none}.section.glossary .glossary-entry .glossary-index{list-style:none;margin:0;padding:0}.section.glossary .glossary-entry .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}body{font-family:serif;color:#000}.page .section{display:block;word-wrap:break-word;overflow:hidden;color:#000;line-height:1.6;-moz-text-size-adjust:100%}.page .section *{box-sizing:border-box;-webkit-box-sizing:border-box;font-size:inherit}.page .section>:first-child{margin-top:0!important}.page .section>:last-child{margin-bottom:0!important}.page .section blockquote,.page .section code,.page .section figure,.page .section img,.page .section pre,.page .section table,.page .section tr{page-break-inside:avoid}.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section p{orphans:3;widows:3}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5{page-break-after:avoid}.page .section em{font-style:italic}.page .section blockquote,.page .section dl,.page .section ol,.page .section p,.page .section table,.page .section ul{margin-top:0;margin-bottom:.8em}.page .section a{color:#000;text-decoration:none;background:0 0}.page .section a:active,.page .section a:focus,.page .section a:hover{outline:0;text-decoration:underline}.page .section img{border:0;max-width:100%}.page .section hr{height:4px;padding:0;margin:1.6em 0;overflow:hidden;background-color:#e7e7e7;border:none}.page .section hr:after,.page .section hr:before{display:table;content:" "}.page .section hr:after{clear:both}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section h6{margin-top:1.2em;margin-bottom:.8em;font-weight:700}.page .section h1{font-size:2em}.page .section h2{font-size:1.75em}.page .section h3{font-size:1.5em}.page .section h4{font-size:1.25em}.page .section h5{font-size:1em}.page .section h6{font-size:1em;color:#777}.page .section code,.page .section pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;direction:ltr;border:none;color:inherit}.page .section pre{overflow:auto;word-wrap:normal;margin:0 0 1.2em;padding:.85em 1em;background:#f7f7f7}.page .section pre>code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;font-size:.85em;white-space:pre;background:0 0}.page .section pre>code:after,.page .section pre>code:before{content:normal}.page .section code{padding:.2em;margin:0;font-size:.85em;background-color:#f7f7f7}.page .section code:after,.page .section code:before{letter-spacing:-.2em;content:"\00a0"}.page .section table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}.page .book-chapter,.page-toc li .inner span.page{display:none}.page .section table td,.page .section table th{padding:6px 13px;border:1px solid #ddd}.page .section table tr{background-color:#fff;border-top:1px solid #ccc}.page .section table tr:nth-child(2n){background-color:#f8f8f8}.page .section ol,.page .section ul{padding:0 0 0 2em;margin:0 0 .8em}.page .section ol ol,.page .section ol ul,.page .section ul ol,.page .section ul ul{margin-top:0;margin-bottom:0}.page .section ol ol{list-style-type:lower-roman}.page .section blockquote{margin:0 0 .8em;padding:0 15px;color:#858585;border-left:4px solid #e5e5e5}.page .section blockquote:first-child{margin-top:0}.page .section blockquote:last-child{margin-bottom:0}.page .section dl{padding:0}.page .section dl dt{padding:0;margin-top:.8em;font-style:italic}.page .section dl dd{padding:0 .8em;margin-bottom:.8em}.page .section dd{margin-left:0}a{color:#000;text-decoration:underline!important}.page-toc li{list-style-type:lower-alpha}.page-toc li .inner{border:none}
+1 -1
View File
@@ -1 +1 @@
.section.glossary>h1,.section.toc>h1{text-align:center}.page .section b,.page .section dl dt,.page .section strong,.page .section table th{font-weight:700}.link-inherit,.link-inherit:focus,.link-inherit:hover{color:inherit}.hidden{display:none}.section.toc>ol{margin:0;padding:0}.section.toc li{list-style:none}.section.toc li .inner{display:block;border-bottom:1px dotted #eee;margin-bottom:4px}.section.toc li .inner a,.section.toc li .inner span{padding-right:5px;border-bottom:1px solid #fff;margin-bottom:-1px}.section.toc li .inner .page{float:right;padding-left:5px}.section.toc li ol{margin:0;padding:0 0 0 2em}.dir-rtl .section.toc li .inner .page{float:left}.dir-rtl .section.toc li ol{margin:0;padding:0 2em 0 0}.section.glossary .glossary-entry{margin-bottom:40px}.section.glossary .glossary-entry h2 a,.section.glossary .glossary-entry h2 a:hover{color:inherit;text-decoration:none}.section.glossary .glossary-entry .glossary-index{list-style:none;margin:0;padding:0}.section.glossary .glossary-entry .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}body{font-family:sans-serif;color:#000;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.page .section{display:block;word-wrap:break-word;overflow:hidden;color:#000;line-height:1.6}.page .section *{-moz-box-sizing:border-box;box-sizing:border-box}.page .section>:first-child{margin-top:0!important}.page .section>:last-child{margin-bottom:0!important}.page .section blockquote,.page .section code,.page .section figure,.page .section img,.page .section pre,.page .section table,.page .section tr{page-break-inside:avoid}.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section p{orphans:3;widows:3}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5{page-break-after:avoid}.page .section em{font-style:italic}.page .section blockquote,.page .section dl,.page .section ol,.page .section p,.page .section table,.page .section ul{margin-top:0;margin-bottom:.8em}.page .section a{color:#4183c4;text-decoration:none;background:0 0}.page .section a:active,.page .section a:focus,.page .section a:hover{outline:0;text-decoration:underline}.page .section img{border:0;max-width:100%}.page .section hr{height:4px;padding:0;margin:1.6em 0;overflow:hidden;background-color:#e7e7e7;border:none}.page .section hr:after,.page .section hr:before{display:table;content:" "}.page .section hr:after{clear:both}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section h6{margin-top:1.2em;margin-bottom:.8em;font-weight:700}.page .section h1{font-size:2em}.page .section h2{font-size:1.75em}.page .section h3{font-size:1.5em}.page .section h4{font-size:1.25em}.page .section h5,.page .section h6{font-size:1em}.page .section code,.page .section pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;direction:ltr;border:none}.page .section pre{overflow:auto;word-wrap:normal;margin:0 0 1.2em;padding:.85em 1em;background:#f7f7f7}.page .section pre>code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;font-size:.85em;white-space:pre;background:0 0}.page .section pre>code:after,.page .section pre>code:before{content:normal}.page .section code{padding:.2em;margin:0;font-size:.85em;background-color:#f7f7f7}.page .section code:after,.page .section code:before{letter-spacing:-.2em;content:"\00a0"}.page .section table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}.page .section table td,.page .section table th{padding:6px 13px;border:1px solid #ddd}.page .section table tr{background-color:#fff;border-top:1px solid #ccc}.page .section table tr:nth-child(2n){background-color:#f8f8f8}.page .section ol,.page .section ul{padding:0 0 0 2em;margin-top:0;margin-bottom:0}.page .section ol ol,.page .section ol ul,.page .section ul ol,.page .section ul ul{margin-top:0;margin-bottom:0}.page .section ol ol{list-style-type:lower-roman}.page .section blockquote{margin:0;padding:0 15px;color:#858585;border-left:4px solid #e5e5e5}.page .section blockquote:first-child{margin-top:0}.page .section blockquote:last-child{margin-bottom:0}.page .section dl{padding:0}.page .section dl dt{padding:0;margin-top:.8em;font-style:italic}.pdf-footer,.pdf-header{margin-top:20px;color:#aaa}.page .section dl dd{padding:0 .8em;margin-bottom:.8em}.page .section dd{margin-left:0}.page .book-chapter{display:none}.pdf-footer{padding-top:10px;border-top:1px solid #eee}.pdf-footer .footer-pages-count{float:right}.pdf-header{padding-bottom:10px;border-bottom:1px solid #eee}
.section.glossary>h1,.section.toc>h1{text-align:center}.page .section b,.page .section dl dt,.page .section strong,.page .section table th{font-weight:700}.link-inherit,.link-inherit:focus,.link-inherit:hover{color:inherit}.hidden{display:none}.section.toc>ol{margin:0;padding:0}.section.toc li{list-style:none}.section.toc li .inner{display:block;border-bottom:1px dotted #eee;margin-bottom:4px}.section.toc li .inner a,.section.toc li .inner span{padding-right:5px;border-bottom:1px solid #fff;margin-bottom:-1px}.section.toc li .inner .page{float:right;padding-left:5px}.section.toc li ol{margin:0;padding:0 0 0 2em}.dir-rtl .section.toc li .inner .page{float:left}.dir-rtl .section.toc li ol{margin:0;padding:0 2em 0 0}.section.glossary .glossary-entry{margin-bottom:40px}.section.glossary .glossary-entry h2 a,.section.glossary .glossary-entry h2 a:hover{color:inherit;text-decoration:none}.page .section,body{color:#000;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.section.glossary .glossary-entry .glossary-index{list-style:none;margin:0;padding:0}.section.glossary .glossary-entry .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}body{font-family:sans-serif}.page .section{display:block;word-wrap:break-word;overflow:hidden;line-height:1.6;-moz-text-size-adjust:100%}.page .section *{box-sizing:border-box;-webkit-box-sizing:border-box;font-size:inherit}.page .section>:first-child{margin-top:0!important}.page .section>:last-child{margin-bottom:0!important}.page .section blockquote,.page .section code,.page .section figure,.page .section img,.page .section pre,.page .section table,.page .section tr{page-break-inside:avoid}.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section p{orphans:3;widows:3}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5{page-break-after:avoid}.page .section em{font-style:italic}.page .section blockquote,.page .section dl,.page .section ol,.page .section p,.page .section table,.page .section ul{margin-top:0;margin-bottom:.8em}.page .section a{color:#4183c4;text-decoration:none;background:0 0}.page .section a:active,.page .section a:focus,.page .section a:hover{outline:0;text-decoration:underline}.page .section img{border:0;max-width:100%}.page .section hr{height:4px;padding:0;margin:1.6em 0;overflow:hidden;background-color:#e7e7e7;border:none}.page .section hr:after,.page .section hr:before{display:table;content:" "}.page .section hr:after{clear:both}.page .section h1,.page .section h2,.page .section h3,.page .section h4,.page .section h5,.page .section h6{margin-top:1.2em;margin-bottom:.8em;font-weight:700}.page .section h1{font-size:2em}.page .section h2{font-size:1.75em}.page .section h3{font-size:1.5em}.page .section h4{font-size:1.25em}.page .section h5{font-size:1em}.page .section h6{font-size:1em;color:#777}.page .section code,.page .section pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;direction:ltr;border:none;color:inherit}.page .section pre{overflow:auto;word-wrap:normal;margin:0 0 1.2em;padding:.85em 1em;background:#f7f7f7}.page .section pre>code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;font-size:.85em;white-space:pre;background:0 0}.page .section pre>code:after,.page .section pre>code:before{content:normal}.page .section code{padding:.2em;margin:0;font-size:.85em;background-color:#f7f7f7}.page .section code:after,.page .section code:before{letter-spacing:-.2em;content:"\00a0"}.page .section table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}.page .section table td,.page .section table th{padding:6px 13px;border:1px solid #ddd}.page .section table tr{background-color:#fff;border-top:1px solid #ccc}.page .section table tr:nth-child(2n){background-color:#f8f8f8}.page .section ol,.page .section ul{padding:0 0 0 2em;margin:0 0 .8em}.page .section ol ol,.page .section ol ul,.page .section ul ol,.page .section ul ul{margin-top:0;margin-bottom:0}.page .section ol ol{list-style-type:lower-roman}.page .section blockquote{margin:0 0 .8em;padding:0 15px;color:#858585;border-left:4px solid #e5e5e5}.page .section blockquote:first-child{margin-top:0}.page .section blockquote:last-child{margin-bottom:0}.page .section dl{padding:0}.page .section dl dt{padding:0;margin-top:.8em;font-style:italic}.pdf-footer,.pdf-header{margin-top:20px;color:#aaa}.page .section dl dd{padding:0 .8em;margin-bottom:.8em}.page .section dd{margin-left:0}.page .book-chapter{display:none}.pdf-footer{padding-top:10px;border-top:1px solid #eee}.pdf-footer .footer-pages-count{float:right}.pdf-header{padding-bottom:10px;border-bottom:1px solid #eee}
+1807 -1447
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+20
View File
@@ -0,0 +1,20 @@
{
"LANGS_CHOOSE": "Seleccioni un idioma",
"GLOSSARY": "Glossari",
"GLOSSARY_INDEX": "Índex",
"GLOSSARY_OPEN": "Glossari",
"GITBOOK_LINK": "Publicat amb GitBook",
"SUMMARY": "Taula de contingut",
"SUMMARY_INTRODUCTION": "Introducció",
"SUMMARY_TOGGLE": "Taula de contingut",
"SEARCH_TOGGLE": "Cerca",
"SEARCH_PLACEHOLDER": "Escriu per cercar",
"FONTSETTINGS_TOGGLE": "Configuració de font",
"SHARE_TOGGLE": "Comparteix",
"SHARE_ON": "Comparteix en {{platform}}",
"FONTSETTINGS_WHITE": "Claro",
"FONTSETTINGS_SEPIA": "Sépia",
"FONTSETTINGS_NIGHT": "Noche",
"FONTSETTINGS_SANS": "Sans",
"FONTSETTINGS_SERIF": "Serif"
}
+20
View File
@@ -0,0 +1,20 @@
{
"LANGS_CHOOSE": "Zvolte jazyk",
"GLOSSARY": "Slovníček",
"GLOSSARY_INDEX": "Rejstřík",
"GLOSSARY_OPEN": "Slovníček",
"GITBOOK_LINK": "Publikováno pomocí GitBook",
"SUMMARY": "Obsah",
"SUMMARY_INTRODUCTION": "Úvod",
"SUMMARY_TOGGLE": "Obsah",
"SEARCH_TOGGLE": "Hledání",
"SEARCH_PLACEHOLDER": "Vyhledat",
"FONTSETTINGS_TOGGLE": "Nastavení písma",
"SHARE_TOGGLE": "Sdílet",
"SHARE_ON": "Sdílet na {{platform}}",
"FONTSETTINGS_WHITE": "Bílá",
"FONTSETTINGS_SEPIA": "Sépie",
"FONTSETTINGS_NIGHT": "Noc",
"FONTSETTINGS_SANS": "Bezpatkové",
"FONTSETTINGS_SERIF": "Patkové"
}
+6 -6
View File
@@ -1,9 +1,9 @@
{
"LANGS_CHOOSE": "言語を選択",
"GLOSSARY": "用語集",
"GLOSSARY_INDEX": "インデックス",
"GLOSSARY_INDEX": "索引",
"GLOSSARY_OPEN": "用語集",
"GITBOOK_LINK": "で公開 GitBook",
"GITBOOK_LINK": "GitBookで公開 ",
"SUMMARY": "目次",
"SUMMARY_INTRODUCTION": "はじめに",
"SUMMARY_TOGGLE": "目次",
@@ -11,10 +11,10 @@
"SEARCH_PLACEHOLDER": "検索すると入力",
"FONTSETTINGS_TOGGLE": "フォント設定",
"SHARE_TOGGLE": "シェア",
"SHARE_ON": "でシェア {{platform}}",
"SHARE_ON": "{{platform}}でシェア",
"FONTSETTINGS_WHITE": "白",
"FONTSETTINGS_SEPIA": "Sepia",
"FONTSETTINGS_SEPIA": "セピア",
"FONTSETTINGS_NIGHT": "夜",
"FONTSETTINGS_SANS": "Sans",
"FONTSETTINGS_SERIF": "Serif"
"FONTSETTINGS_SANS": "ゴシック体",
"FONTSETTINGS_SERIF": "明朝体"
}
+20
View File
@@ -0,0 +1,20 @@
{
"LANGS_CHOOSE": "Välj språk",
"GLOSSARY": "Gloslista",
"GLOSSARY_INDEX": "Index",
"GLOSSARY_OPEN": "Gloslista",
"GITBOOK_LINK": "Publicera med GitBook",
"SUMMARY": "Innehållsförteckning",
"SUMMARY_INTRODUCTION": "Inledning",
"SUMMARY_TOGGLE": "Innehållsförteckning",
"SEARCH_TOGGLE": "Sök",
"SEARCH_PLACEHOLDER": "Skriv sökord",
"FONTSETTINGS_TOGGLE": "Textinställningar",
"SHARE_TOGGLE": "Dela",
"SHARE_ON": "Dela på {{platform}}",
"FONTSETTINGS_WHITE": "Ljus",
"FONTSETTINGS_SEPIA": "Sepia",
"FONTSETTINGS_NIGHT": "Mörk",
"FONTSETTINGS_SANS": "Sans",
"FONTSETTINGS_SERIF": "Serif"
}
+20
View File
@@ -0,0 +1,20 @@
{
"LANGS_CHOOSE": "Dil seçimi",
"GLOSSARY": "Sözlük",
"GLOSSARY_INDEX": "Dizin",
"GLOSSARY_OPEN": "Sözlük",
"GITBOOK_LINK": "GitBook ile yayınla",
"SUMMARY": "İçindekiler",
"SUMMARY_INTRODUCTION": "Giriş",
"SUMMARY_TOGGLE": "İçindekiler",
"SEARCH_TOGGLE": "Arama",
"SEARCH_PLACEHOLDER": "Aramak istediğiniz",
"FONTSETTINGS_TOGGLE": "Font Ayarları",
"SHARE_TOGGLE": "Paylaş",
"SHARE_ON": "{{platform}} ile paylaş",
"FONTSETTINGS_WHITE": "Beyaz",
"FONTSETTINGS_SEPIA": "Sepya",
"FONTSETTINGS_NIGHT": "Karanlık",
"FONTSETTINGS_SANS": "Sans",
"FONTSETTINGS_SERIF": "Serif"
}
+3 -1
View File
@@ -36,6 +36,7 @@ function start(config) {
});
events.trigger('start', config);
navigation.notify();
}
// Export APIs for plugins
@@ -59,7 +60,7 @@ var gitbook = {
// Modules mapping for plugins
var MODULES = {
'gitbook': gitbook,
'jQuery': $,
'jquery': $,
'lodash': _
};
@@ -68,6 +69,7 @@ window.$ = $;
window.jQuery = $;
window.require = function(mods, fn) {
mods = _.map(mods, function(mod) {
mod = mod.toLowerCase();
if (!MODULES[mod]) {
throw new Error('GitBook module '+mod+' doesn\'t exist');
}
+9 -4
View File
@@ -75,7 +75,11 @@ function updateNavigationPosition() {
$('.navigation-next').css('margin-right', (bodyInnerWidth - pageWrapperWidth) + 'px');
}
function preparePage() {
function notifyPageChange() {
events.trigger('page.change');
}
function preparePage(notify) {
var $bookBody = $('.book-body');
var $bookInner = $bookBody.find('.body-inner');
var $pageWrapper = $bookInner.find('.page-wrapper');
@@ -91,7 +95,7 @@ function preparePage() {
$bookBody.scrollTop(0);
// Notify
events.trigger('page.change');
if (notify !== false) notifyPageChange();
}
function isLeftClickEvent(e) {
@@ -150,11 +154,12 @@ function init() {
$(window).resize(updateNavigationPosition);
// Prepare current page
preparePage();
preparePage(false);
}
module.exports = {
init: init,
goNext: goNext,
goPrev: goPrev
goPrev: goPrev,
notify: notifyPageChange
};
+3 -1
View File
@@ -1,3 +1,5 @@
module.exports = {
isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
isMobile: function() {
return (document.width <= 600);
}
};
+6 -1
View File
@@ -25,9 +25,14 @@ function isOpen() {
// Prepare sidebar: state and toggle button
function init() {
// Init last state if not mobile
if (!platform.isMobile) {
if (!platform.isMobile()) {
toggleSidebar(storage.get('sidebar', true), false);
}
// Close sidebar after clicking a link on mobile
$(document).on('click', '.book-summary li.chapter a', function(e) {
if (platform.isMobile()) toggleSidebar(false, false);
});
}
// Filter summary with a list of path
+26 -4
View File
@@ -1,14 +1,36 @@
var $ = require('jquery');
var url = require('url');
var path = require('path');
var state = {};
state.update = function(dom) {
var $book = $(dom.find(".book"));
var $book = $(dom.find('.book'));
state.$book = $book;
state.level = $book.data("level");
state.basePath = $book.data("basepath");
state.revision = $book.data("revision");
state.level = $book.data('level');
state.basePath = $book.data('basepath');
// If book is multilingual, language of this book
state.innerLanguage = $book.data('innerlanguage');
// Date of build
state.revision = $book.data('revision');
// Original path of the file
state.filepath = $book.data('filepath');
// Title of the chapter
state.chapterTitle = $book.data('chapter-title');
// Absolute url to the root of the book (inner book)
state.root = url.resolve(
location.protocol+'//'+location.host,
path.dirname(path.resolve(location.pathname.replace(/\/$/, '/index.html'), state.basePath))
).replace(/\/?$/, '/');
// Absolute root to the language (for multilingual book)
state.bookRoot = state.innerLanguage? url.resolve(state.root, '..') : state.root;
};
state.update($);
+4 -1
View File
@@ -117,7 +117,7 @@ function updateButton(opts) {
// Create button
var $btn = $('<a>', {
'class': 'btn',
'text': opts.text,
'text': opts.text? ' ' + opts.text : '',
'aria-label': opts.label,
'href': '#'
});
@@ -156,6 +156,8 @@ function updateButton(opts) {
$result = $btn;
}
$result.addClass('js-toolbar-action');
if (_.isNumber(opts.index) && opts.index >= 0) {
insertAt($toolbar, '.btn, .dropdown, h1', opts.index, $result);
} else {
@@ -165,6 +167,7 @@ function updateButton(opts) {
// Update all buttons
function updateAllButtons() {
$('.js-toolbar-action').remove();
_.each(buttons, updateButton);
}
-254
View File
@@ -1,254 +0,0 @@
.markup-content(@md-color: #000, @md-line-height: 1.7, @md-link-color: #4183c4, @md-code-background: #f7f7f7, @md-code-fontsize: 0.85, @md-blockquote-color: #858585, @md-blockquote-border: #e5e5e5) {
// Rate of growth for headings
@scale: 0.25;
// Spacing between blocks
@spacing: @md-line-height * 2 * @scale * 1em;
@spacing-lg: @md-line-height * 3 * @scale * 1em;
display: block;
word-wrap: break-word;
overflow: hidden;
color: @md-color;
line-height: @md-line-height;
* {
.box-sizing(border-box);
}
& > *:first-child {
margin-top: 0 !important;
}
& > *:last-child {
margin-bottom: 0 !important;
}
/* Printing */
pre, code, blockquote, tr, img, table, figure {
page-break-inside: avoid;
}
p, h2, h3, h4, h5 {
orphans: 3;
widows: 3;
}
h1, h2, h3, h4, h5 {
page-break-after: avoid;
}
/* Typography */
strong, b {
font-weight: bold;
}
em {
font-style: italic;
}
/* Spacing */
p, blockquote, ul, ol, dl, table {
margin-top: 0;
margin-bottom: @spacing;
}
/* Links */
a {
color: @md-link-color;
text-decoration: none;
background: transparent;
&:hover,
&:focus,
&:active {
outline: 0;
text-decoration: underline;
}
}
/* Images */
img {
border: 0;
max-width: 100%;
}
/* Horizontal lines */
hr {
height: 4px;
padding: 0;
margin: @md-line-height * 1em 0;
overflow: hidden;
background-color: #e7e7e7;
border: none;
&:before, &:after {
display: table;
content: " ";
}
&:after {
clear: both;
}
}
/* Headings */
h1, h2, h3, h4, h5, h6 {
margin-top: @spacing-lg;
margin-bottom: @spacing;
font-weight: bold;
}
h1 {
font-size: (4 * @scale) + 1em;
}
h2 {
font-size: (3 * @scale) + 1em;
}
h3 {
font-size: (2 * @scale) + 1em;
}
h4 {
font-size: @scale + 1em;
}
h5 {
font-size: 1em;
}
h6 {
font-size: 1em;
}
/* Code blocks */
code, pre {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
direction: ltr;
margin: 0px;
padding: 0px;
border: none;
}
pre {
overflow: auto;
word-wrap: normal;
margin: 0px;
padding: 0.85em 1em;
margin-bottom: @spacing-lg;
background: @md-code-background;
> code {
display: inline;
max-width: initial;
padding: 0;
margin: 0;
overflow: initial;
line-height: inherit;
font-size: @md-code-fontsize * 1em;
white-space: pre;
background: transparent;
&:before, &:after {
content: normal;
}
}
}
code {
padding: 0.2em;
margin: 0;
font-size: @md-code-fontsize * 1em;
background-color: @md-code-background;
&:before, &:after {
letter-spacing: -0.2em;
content: "\00a0";
}
}
/* Tables */
table {
display: table;
width: 100%;
border-collapse: collapse;
border-spacing: 0;
overflow: auto;
td, th {
padding: 6px 13px;
border: 1px solid #ddd;
}
tr {
background-color: #fff;
border-top: 1px solid #ccc;
&:nth-child(2n) {
background-color: #f8f8f8;
}
}
th {
font-weight: bold;
}
}
/* Lists */
ul, ol {
padding: 0;
margin-top: 0;
margin-bottom: 0;
padding-left: 2em;
ol, ul {
margin-top: 0;
margin-bottom: 0;
}
}
ol ol {
list-style-type: lower-roman;
}
/* Blockquote */
blockquote {
margin: 0;
padding: 0 15px;
color: @md-blockquote-color;
border-left: 4px solid @md-blockquote-border;
&:first-child {
margin-top: 0;
}
&:last-child {
margin-bottom: 0;
}
}
/* Description Lists */
dl {
padding: 0;
dt {
padding: 0;
margin-top: @spacing;
font-style: italic;
font-weight: bold;
}
dd {
padding: 0 @spacing;
margin-bottom: @spacing;
}
}
dd {
margin-left: 0;
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
@import "./markup.less";
@import "../../../node_modules/gitbook-markdown-css/less/mixin.less";
.link-inherit {
color: inherit;
+1 -1
View File
@@ -13,7 +13,7 @@ body {
.page {
// Section and first titles
.section {
.markup-content(@text-color, 1.6, @md-link-color: @link-color);
.gitbook-markdown(@md-color: @text-color, @md-line-height: 1.6, @md-link-color: @link-color);
}
// Hide the title (only used to build PDF table of content)
+1 -1
View File
@@ -3,7 +3,7 @@
}
.book .book-body .page-wrapper .page-inner section.normal {
.markup-content(@content-color, @content-line-height);
.gitbook-markdown(@md-color: @content-color, @md-line-height: @content-line-height);
.glossary-term {
cursor: help;
+7 -1
View File
@@ -14,7 +14,13 @@
{% block description %}{% if progress.current.level == "0" %}{{ description }}{% endif %}{% endblock %}
{% block content %}
<div class="book" data-level="{{ progress.current.level }}" data-basepath="{{ basePath }}" data-revision="{{ revision }}">
<div class="book"
data-level="{{ progress.current.level }}"
data-chapter-title="{{ progress.current.title }}"
data-filepath="{{ progress.current.path }}"
data-basepath="{{ basePath }}"
data-revision="{{ revision }}"
data-innerlanguage="{{ innerlanguage }}">
{% include "includes/summary.html" %}
<div class="book-body">
<div class="body-inner">