Compare commits

...

35 Commits

Author SHA1 Message Date
Samy Pessé 09b038b16d Bump version to 2.3.0 2015-09-01 17:44:53 +02:00
Samy Pessé cf601d97ad Improve error handling for failed image download 2015-09-01 17:38:33 +02:00
Samy Pessé 80edad53d4 Update nunjucks to fix raw and loader 2015-09-01 17:25:43 +02:00
Samy Pessé a972b32769 Update nunjucks@2.0.0 2015-08-28 08:45:28 +02:00
Samy Pessé efcaae3e60 Add author for hebrew 2015-08-27 19:07:31 +02:00
Samy Pessé e0ee591638 Merge pull request #877 from a-moses/hebrew
hebrew support theme
2015-08-27 19:06:26 +02:00
Samy Pessé 310a6d909f Add method 'get' to config object (helper for plugins) 2015-08-27 15:26:12 +02:00
Samy Pessé cefd8fc50f Don't fail if hook returns nothing for "page" and "page:before" 2015-08-27 15:04:28 +02:00
Samy Pessé a4422593f2 Add back page:before and page as non-deprecated 2015-08-26 11:16:02 +02:00
Samy Pessé e2c5d22756 Merge pull request #844 from xcv58/master
Fix #843 ignore _book in watch.js
2015-08-26 11:05:43 +02:00
Samy Pessé 84385d9dc3 Merge pull request #881 from mortonfox/patch-1
Fix Plugins link.
2015-08-26 11:01:28 +02:00
Morton Fox 6cfa4c8ab7 Fix Plugins link. 2015-08-25 23:35:15 -04:00
a-moses c76ccc53e1 Update he.json 2015-08-23 09:59:14 +03:00
a-moses d48eafb1a2 hebrew support theme
full Hebrew support for GITBOOK (with rtl )

* Sans and Serif may still in original name fonts
2015-08-23 09:53:25 +03:00
Aaron O'Mullan 302d9b4b91 Merge pull request #849 from GitbookIO/improve/remove-webfonts
Use system fonts instead of webfonts
2015-08-13 19:19:35 +02:00
Samy Pessé a091a7f68b Update gitbook-parsers@0.7.7 2015-08-09 15:45:04 +02:00
Aaron O'Mullan 53621f6de3 Use system fonts instead of webfonts 2015-08-08 17:35:05 +02:00
Samy Pessé 288b965db3 Merge pull request #847 from GitbookIO/fix/flicker
Improve header merge on page change
2015-08-07 16:55:42 +02:00
Aaron O'Mullan 578c9dcfc6 Improve header merge on page change
Prevents flickering (style reset)

Fixes #782, #838, #840
2015-08-07 16:46:23 +02:00
xcv58 64de17b248 ignore _book in watch.js 2015-08-04 00:50:31 -04:00
Samy Pesse 501843d624 Bump version to 2.2.0 2015-07-28 15:28:38 -07:00
Samy Pesse 508ce4283e Fix #819: codes must always be ltr 2015-07-28 15:25:12 -07:00
Samy Pessé 4aa8e66549 Merge pull request #813 from MrMaksimize/pdf-options
Allowing for custom chapter-mark and page-break in PDF.
2015-07-01 18:00:31 -04:00
Maksim Pecherskiy 917a6f70d8 Allowing for custom chapter-mark and page-break in PDF. 2015-06-30 19:48:51 -07:00
Samy Pesse 2f5e53da55 Update highlight.js@8.6.0 2015-06-29 10:02:35 -04:00
Samy Pesse c3cdefc90a Simpler template for summary 2015-06-29 09:58:23 -04:00
Samy Pesse 9c580e4989 Fix #802: make book.json accessible as "config." in templating 2015-06-19 16:28:46 +02:00
Samy Pessé 50c902c4e4 Merge pull request #805 from GitbookIO/fix/804
Fix #804
2015-06-18 11:16:32 +02:00
Samy Pesse 84b6e0bde6 Add test for kwargs 2015-06-18 11:15:44 +02:00
Samy Pesse abc29c3fba Fix #804: correctly extract kwargs from blocks 2015-06-18 11:11:47 +02:00
Samy Pesse 8356c534f5 Add failing tests for block's arguments 2015-06-18 11:09:02 +02:00
Samy Pessé 78ff2687b4 Merge pull request #797 from nghong/vi-locale
Adding Vietnamese locale support
2015-06-13 11:15:00 +02:00
Hong Nguyen 9b6586fb36 Add translator name to AUTHORS.md 2015-06-13 16:13:34 +07:00
Hong Nguyen ea133219d0 Minor fix 2015-06-13 16:08:21 +07:00
Hong Nguyen c9b5d81a3c Add Vietnamese locale support 2015-06-13 15:42:49 +07:00
42 changed files with 170 additions and 141 deletions
+18 -14
View File
@@ -21,32 +21,36 @@ Translators
------------
- German
- Winnie (@winniehell)
- Winnie (@winniehell)
- Italian
- Giulio Bonanome (@gbonanome)
- Giulio Bonanome (@gbonanome)
- Russian
- Andrey Akinshin (@AndreyAkinshin)
- Andrey Akinshin (@AndreyAkinshin)
- Norwegian
- Knut Melvær (@kmelve)
- Knut Melvær (@kmelve)
- Persian (Farsi)
- Mohammad Hossein Mojtahedi (@mhm5000)
- Mohammad Hossein Mojtahedi (@mhm5000)
- Polish
- Łukasz Szeremeta (@lszeremeta)
- Łukasz Szeremeta (@lszeremeta)
- Portuguese
- Ryan O'Mullan (@RyanOM)
- Ryan O'Mullan (@RyanOM)
- Spanish
- Ryan O'Mullan (@RyanOM)
- Ryan O'Mullan (@RyanOM)
- Simplifiled Chinese
- Hu Hao (@howiehu)
- Hu Hao (@howiehu)
- Traditional Chinese
- Hu Hao (@howiehu)
- Hu Hao (@howiehu)
- French
- Samy Pessé (@SamyPesse)
- Samy Pessé (@SamyPesse)
- Romanian
- Iancu Aurel (@awrelll)
- Finnish
- Tommi Savikko (@savikko)
- Tommi Savikko (@savikko)
- Japanese
- Iancu Aurel (@awrelll)
- Iancu Aurel (@awrelll)
- Korean
- Iancu Aurel (@awrelll)
- Iancu Aurel (@awrelll)
- Vietnamese
- Hong Nguyen (@nghong)
- Hebrew
- @a-moses
+18
View File
@@ -2,6 +2,24 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## 2.3.0
- Fix nunjucks issue with multiple `{% raw %}` blocks
- Fix crash when git conref failed
- Fix crash when failed to download remote image (better error message)
- Fix flicking effect when changing page (big UX improvement)
- Add Hebrew translation (`he`)
- Add utility method `book.config.get` for plugins
- Hooks `page:before` and `page` are no longer deprecated
- Remove webfonts to make website lighter
- Make glossary's order case insensitive
## 2.2.0
- Fix direction in code blocks (always LTR)
- Add options `chapterMark` and `pageBreaksBefore` for PDF
- Update code highlighting library
- `book.json` accessible as `config` in templating syntax
- Add Vietnamese translation (`vi`)
## 2.1.0
- Fix error in calcul of `levels` in table of contents, error introduced a few versions ago
- Add optional `styles/print.css` to replace `print.css` used in ebook
+1 -1
View File
@@ -50,7 +50,7 @@ $ gitbook build
* [AsciiDoc Support](http://help.gitbook.com/format/asciidoc.html)
* [Variables and Templating](http://help.gitbook.com/format/templating.html)
* [Content References](http://help.gitbook.com/format/conrefs.html)
* [Plugins](http://help.gitbook.com/plugins/index.html)
* [Plugins](http://help.gitbook.com/format/plugins.html)
* Interractive reader website:
* Search
* Font Settings (Serif, Sans Serif)
+1 -1
View File
@@ -512,7 +512,7 @@ Book.prototype.parsePage = function(filename, options) {
var interpolate = function(fn) {
return Q(fn(page))
.then(function(_page) {
page = _page;
page = _page || page;
});
};
+12
View File
@@ -156,6 +156,10 @@ Configuration.prototype.normalizeLanguage = function() {
return i18n.normalizeLanguage(this.options.language);
};
// Return a configuration
Configuration.prototype.get = function(key, def) {
return _.get(this.options, key, def);
};
// Default configuration
Configuration.DEFAULT = {
@@ -246,6 +250,14 @@ Configuration.DEFAULT = {
// Choices are [u’a0’, u’a1’, u’a2’, u’a3’, u’a4’, u’a5’, u’a6’, u’b0’, u’b1’, u’b2’, u’b3’, u’b4’, u’b5’, u’b6’, u’legal’, u’letter’]
"paperSize": "a4",
// How to mark detected chapters.
// Choices are “pagebreak”, “rule”, "both" or “none”.
"chapterMark" : "pagebreak",
// An XPath expression. Page breaks are inserted before the specified elements.
// To disable use the expression: "/"
"pageBreaksBefore": "/",
// Margin (in pts)
// Note: 72 pts equals 1 inch
"margin": {
+2 -2
View File
@@ -68,8 +68,6 @@ Generator.prototype.finish = function() {
"--book-producer": "GitBook",
"--publisher": "GitBook",
"--chapter": "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter ')]",
"--chapter-mark": "pagebreak",
"--page-breaks-before": "/",
"--level1-toc": "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-1 ')]",
"--level2-toc": "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-2 ')]",
"--level3-toc": "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-3 ')]",
@@ -82,6 +80,8 @@ Generator.prototype.finish = function() {
var pdfOptions = that.options.pdf;
_.extend(_options, {
"--chapter-mark": String(pdfOptions.chapterMark),
"--page-breaks-before": String(pdfOptions.pageBreaksBefore),
"--margin-left": String(pdfOptions.margin.left),
"--margin-right": String(pdfOptions.margin.right),
"--margin-top": String(pdfOptions.margin.top),
+1 -1
View File
@@ -33,7 +33,7 @@ var Plugin = function(book, name) {
// Type of plugins resources
Plugin.RESOURCES = ["js", "css"];
Plugin.HOOKS = [
"init", "finish", "finish:before"
"init", "finish", "finish:before", "page", "page:before"
]
// Load from a name
+4 -1
View File
@@ -250,7 +250,7 @@ TemplateEngine.prototype.addBlock = function(name, block) {
// Extract main body and kwargs
var body = args.pop();
var kwargs = args.pop() || {};
var kwargs = _.isObject(_.last(args))? args.pop() : {};
// Extract blocks body
var _blocks = _.map(block.blocks, function(blockName, i){
@@ -316,6 +316,9 @@ TemplateEngine.prototype.renderString = function(content, context, options) {
// Variables from book.json
book: this.book.options.variables,
// Complete book.json
config: this.book.options,
// infos about gitbook
gitbook: {
version: pkg.version,
+4
View File
@@ -64,6 +64,10 @@ function writeStream(filename, st) {
d.reject(err);
});
st.on('error', function(err) {
d.reject(err);
});
st.pipe(wstream);
return d.promise;
+1 -1
View File
@@ -83,7 +83,7 @@ function cloneGitRepo(host, ref) {
return exec("git clone "+host+" "+repoPath)
.then(function() {
return exec("git checkout "+ref, { cwd: repoPath });
})
});
})
.thenResolve(repoPath);
});
+7 -1
View File
@@ -285,7 +285,13 @@ function convertImages(images, options) {
if (!image.origin && !_.contains(downloaded, image.origin)) return;
options.book.log.debug("download image", image.origin, "...");
downloaded.push(image.origin);
return options.book.log.debug.promise(fs.writeStream(imgin, request(image.origin)));
return options.book.log.debug.promise(fs.writeStream(imgin, request(image.origin)))
.fail(function(err) {
if (!_.isError(err)) err = new Error(err);
err.message = 'Fail downloading '+image.origin+': '+err.message;
throw err;
});
})
// Write svg if content
+1
View File
@@ -19,6 +19,7 @@ function watch(dir) {
var watcher = chokidar.watch(toWatch, {
cwd: dir,
ignored: '_book/**',
ignoreInitial: true
});
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "gitbook",
"version": "2.1.0",
"version": "2.3.0",
"homepage": "https://www.gitbook.com",
"description": "Library and cmd utility to generate GitBooks",
"main": "lib/index.js",
@@ -12,8 +12,8 @@
"resolve": "0.6.3",
"fs-extra": "0.16.5",
"fstream-ignore": "1.0.2",
"gitbook-parsers": "0.7.6",
"nunjucks": "mozilla/nunjucks#103513c294835bcbe64222de6db494e2555e294e",
"gitbook-parsers": "0.7.7",
"nunjucks": "mozilla/nunjucks#b4351ec0752b102ebd02c5e2cbc2898a6e0e4839",
"nunjucks-autoescape": "1.0.0",
"nunjucks-filter": "1.0.0",
"i18n": "0.5.0",
@@ -32,7 +32,7 @@
"npm": "2.4.1",
"dom-serializer": "0.1.0",
"spawn-cmd": "0.0.2",
"highlight.js": "8.4.0",
"highlight.js": "8.6.0",
"escape-string-regexp": "1.0.3"
},
"devDependencies": {
+14
View File
@@ -185,6 +185,20 @@ describe('Plugins', function () {
content.should.equal("hello;the;world");
});
});
it('should correctly extend template blocks with arguments', function() {
return testTpl('{% test5args "a", "b", "c" %}{% endtest5args %}')
.then(function(content) {
content.should.equal("test5a,b,ctest5");
});
});
it('should correctly extend template blocks with args and kwargs', function() {
return testTpl('{% test5kwargs "a", "b", "c", d="test", e="test2" %}{% endtest5kwargs %}')
.then(function(content) {
content.should.equal("test5a,b,c,d:test,e:test2,__keywords:truetest5");
});
});
});
});
+16 -1
View File
@@ -36,6 +36,21 @@ module.exports = {
assert(blk.blocks[1].name, "finally");
return [blk.body, blk.blocks[0].body, blk.blocks[1].body].join(blk.kwargs.separator);
}
}
},
"test5args": {
process: function(blk) {
return "test5"+blk.args.join(',')+"test5";
}
},
"test5kwargs": {
process: function(blk) {
var s = blk.args.join(',');
for (var key in blk.kwargs) {
s = s + ','+key+':'+blk.kwargs[key];
}
return "test5"+s+"test5";
}
},
}
};
+1 -1
View File
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+21
View File
@@ -0,0 +1,21 @@
{
"direction": "rtl",
"LANGS_CHOOSE": "בחר שפה",
"GLOSSARY": "מונחים",
"GLOSSARY_INDEX": "מפתח",
"GLOSSARY_OPEN": "מונחים",
"GITBOOK_LINK": "הוצאה לאור באמצעות גיט-בוק GITBOOK",
"SUMMARY": "תוכן העניינים",
"SUMMARY_INTRODUCTION": "הוראות",
"SUMMARY_TOGGLE": "תקציר",
"SEARCH_TOGGLE": "חיפוש",
"SEARCH_PLACEHOLDER": "סוג החיפוש",
"FONTSETTINGS_TOGGLE": "הגדרת אותיות",
"SHARE_TOGGLE": "שתף",
"SHARE_ON": "{{platform}} שתף ב",
"FONTSETTINGS_WHITE": "בהיר",
"FONTSETTINGS_SEPIA": "חום כהה",
"FONTSETTINGS_NIGHT": "מצב לילה",
"FONTSETTINGS_SANS": "Sans",
"FONTSETTINGS_SERIF": "Serif"
}
+20
View File
@@ -0,0 +1,20 @@
{
"LANGS_CHOOSE": "Lựa chọn ngôn ngữ",
"GLOSSARY": "Chú giải",
"GLOSSARY_INDEX": "Chỉ mục",
"GLOSSARY_OPEN": "Chú giải",
"GITBOOK_LINK": "Xuất bản với GitBook",
"SUMMARY": "Mục Lục",
"SUMMARY_INTRODUCTION": "Giới thiệu",
"SUMMARY_TOGGLE": "Mục Lục",
"SEARCH_TOGGLE": "Tìm kiếm",
"SEARCH_PLACEHOLDER": "Nhập thông tin cần tìm",
"FONTSETTINGS_TOGGLE": "Tùy chỉnh phông chữ",
"SHARE_TOGGLE": "Chia sẻ",
"SHARE_ON": "Chia sẻ trên {{platform}}",
"FONTSETTINGS_WHITE": "Sáng",
"FONTSETTINGS_SEPIA": "Vàng nâu",
"FONTSETTINGS_NIGHT": "Tối",
"FONTSETTINGS_SANS": "Sans",
"FONTSETTINGS_SERIF": "Serif"
}
+17 -5
View File
@@ -35,13 +35,25 @@ define([
var $pageHead = $page.find("[data-element=head]");
var $pageBody = $page.find('.book');
////
// Merge heads
var headContent = $pageHead.html()
// !! Warning !!: we only update necessary portions to avoid strange behavior (page flickering etc ...)
////
$("head style").each(function() {
headContent = headContent + this.outerHTML
});
$("head").html(headContent);
// Update title
document.title = $pageHead.find("title").text();
// Reference to $("head");
var $head = $("head");
// Update next & prev <link> tags
// Remove old
$head.find("link[rel=prev]").remove();
$head.find("link[rel=next]").remove();
// Add new next * prev <link> tags
$head.append($pageHead.find("link[rel=prev]"));
$head.append($pageHead.find("link[rel=next]"));
// Merge body
var bodyClass = $(".book").attr("class");
+1
View File
@@ -51,6 +51,7 @@
pre {
font-family: monospace, monospace;
font-size: 1em;
direction: ltr;
}
table {
+1 -1
View File
@@ -4,7 +4,6 @@
@import "mixins.less";
@import "website/fonts.less";
@import "website/variables.less";
@import "website/languages.less";
@import "website/header.less";
@@ -44,4 +43,5 @@ body {
font-smoothing: antialiased;
font-family: @font-family-base;
font-size: @font-size-base;
letter-spacing: .2px;
}
-96
View File
@@ -1,96 +0,0 @@
@font-face {
font-family: 'Merriweather';
font-style: normal;
font-weight: 250;
src: local('Merriweather Light'),url('@{FontPath}/merriweather/250.woff') format('woff');
}
@font-face {
font-family: 'Merriweather';
font-style: italic;
font-weight: 250;
src: local('Merriweather Light Italic'),url('@{FontPath}/merriweather/250i.woff') format('woff');
}
@font-face {
font-family: 'Merriweather';
font-style: normal;
font-weight: 400;
src: local('Merriweather'),url('@{FontPath}/merriweather/400.woff') format('woff');
}
@font-face {
font-family: 'Merriweather';
font-style: italic;
font-weight: 400;
src: local('Merriweather Italic'),url('@{FontPath}/merriweather/400i.woff') format('woff');
}
@font-face {
font-family: 'Merriweather';
font-style: normal;
font-weight: 700;
src: local('Merriweather Bold'),url('@{FontPath}/merriweather/700.woff') format('woff');
}
@font-face {
font-family: 'Merriweather';
font-style: italic;
font-weight: 700;
src: local('Merriweather Bold Italic'),url('@{FontPath}/merriweather/700i.woff') format('woff');
}
@font-face {
font-family: 'Merriweather';
font-style: normal;
font-weight: 900;
src: local('Merriweather Heavy'),url('@{FontPath}/merriweather/900.woff') format('woff');
}
@font-face {
font-family: 'Merriweather';
font-style: italic;
font-weight: 900;
src: local('Merriweather Heavy Italic'),url('@{FontPath}/merriweather/900i.woff') format('woff');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 300;
src: local('Open Sans Light'),url('@{FontPath}/opensans/300.woff') format('woff');
}
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 300;
src: local('Open Sans Light Italic'),url('@{FontPath}/opensans/300i.woff') format('woff');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans Regular'),url('@{FontPath}/opensans/400.woff') format('woff');
}
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 400;
src: local('Open Sans Italic'),url('@{FontPath}/opensans/400i.woff') format('woff');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 600;
src: local('Open Sans Semibold'),url('@{FontPath}/opensans/600.woff') format('woff');
}
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 600;
src: local('Open Sans Semibold Italic'),url('@{FontPath}/opensans/600i.woff') format('woff');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 700;
src: local('Open Sans Bold'),url('@{FontPath}/opensans/700.woff') format('woff');
}
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 700;
src: local('Open Sans Bold Italic'),url('@{FontPath}/opensans/700i.woff') format('woff');
}
+2 -2
View File
@@ -95,8 +95,8 @@
@border-radius-small: 1px;
// Fonts
@font-family-serif: "Merriweather", Georgia, serif;
@font-family-sans: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
@font-family-serif: Georgia, serif;
@font-family-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
@font-family-base: @font-family-sans;
@headings-font-family: inherit;
@@ -4,21 +4,15 @@
{% if item.path and item.exists %}
{% if not item.external %}
<a href="{{ basePath }}/{{ item.path|contentLink }}">
<i class="fa fa-check"></i>
{% if item.level != "0" %}
<b>{{ item.level }}.</b>
{% endif %}
{{ item.title }}
</a>
{% else %}
<a target="_blank" href="{{ item.path }}">
{% endif %}
<i class="fa fa-check"></i>
{% if item.level != "0" %}
<b>{{ item.level }}.</b>
{% endif %}
{{ item.title }}
</a>
{% endif %}
{% else %}
<span><b>{{ item.level }}.</b> {{ item.title }}</span>
{% endif %}