Compare commits

...

14 Commits

Author SHA1 Message Date
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
9 changed files with 73 additions and 41 deletions
+14 -24
View File
@@ -2,32 +2,14 @@
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.7
- Use Arial as default font for PDFs
- Client side API provides `gitbook.state.root`
- Normalize heading IDs like GitHub
## 2.5.2
- Fix custom stylesheets for ebook generation
- Trigger event `start` before `page.change`
## 2.5.0-beta.6
- Fix default style for pdf footer and header
- Correctly handle query in image urls
- Fix templating in imported content
- Use helvetica as default font for PDFs
## 2.5.1
- Fix calcul of `gitbook.state.root` when serving HTML index as `/`
## 2.5.0-beta.5
- Fix position of sidebar toggle button
- Update asciidoc parser to remove git dependency
## 2.5.0-beta.4
- Fix compatibility for some plugins (like `autocover`)
- Fix position of sidebar toggle button when glossary button is present
## 2.5.0-beta.3
- Fix installation of plugins when using a pre-release
## 2.5.0-beta.2
- Fix support for pre-releases
## 2.5.0-beta.1
## 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)`
@@ -36,6 +18,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`)
+1 -1
View File
@@ -67,7 +67,7 @@ Generator.prototype.getPDFTemplate = function(id) {
}
tpl = juice(tpl, {
extraCss: stylesheets.concat('/n')
extraCss: stylesheets.join('\n\n')
});
return tpl;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "gitbook",
"version": "2.5.0-beta.7",
"version": "2.5.2",
"homepage": "https://www.gitbook.com",
"description": "Library and cmd utility to generate GitBooks",
"main": "lib/index.js",
+28 -7
View File
@@ -24403,6 +24403,7 @@ function start(config) {
});
events.trigger('start', config);
navigation.notify();
}
// Export APIs for plugins
@@ -24426,7 +24427,7 @@ var gitbook = {
// Modules mapping for plugins
var MODULES = {
'gitbook': gitbook,
'jQuery': $,
'jquery': $,
'lodash': _
};
@@ -24435,6 +24436,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');
}
@@ -24580,7 +24582,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');
@@ -24596,7 +24602,7 @@ function preparePage() {
$bookBody.scrollTop(0);
// Notify
events.trigger('page.change');
if (notify !== false) notifyPageChange();
}
function isLeftClickEvent(e) {
@@ -24655,13 +24661,14 @@ function init() {
$(window).resize(updateNavigationPosition);
// Prepare current page
preparePage();
preparePage(false);
}
module.exports = {
init: init,
goNext: goNext,
goPrev: goPrev
goPrev: goPrev,
notify: notifyPageChange
};
},{"./events":12,"./loading":15,"./state":19,"jquery":8,"url":7}],17:[function(require,module,exports){
@@ -24735,10 +24742,21 @@ state.update = function(dom) {
state.$book = $book;
state.level = $book.data('level');
state.basePath = $book.data('basepath');
// 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
state.root = url.resolve(location.origin, path.dirname(path.resolve(location.pathname, state.basePath)));
state.root = url.resolve(
location.protocol+'//'+location.host,
path.dirname(path.resolve(location.pathname.replace(/\/$/, '/index.html'), state.basePath))
);
};
state.update($);
@@ -24904,7 +24922,7 @@ function updateButton(opts) {
// Create button
var $btn = $('<a>', {
'class': 'btn',
'text': opts.text,
'text': opts.text? ' ' + opts.text : '',
'aria-label': opts.label,
'href': '#'
});
@@ -24943,6 +24961,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 {
@@ -24952,6 +24972,7 @@ function updateButton(opts) {
// Update all buttons
function updateAllButtons() {
$('.js-toolbar-action').remove();
_.each(buttons, updateButton);
}
+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
};
+12 -1
View File
@@ -10,10 +10,21 @@ state.update = function(dom) {
state.$book = $book;
state.level = $book.data('level');
state.basePath = $book.data('basepath');
// 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
state.root = url.resolve(location.origin, path.dirname(path.resolve(location.pathname, state.basePath)));
state.root = url.resolve(
location.protocol+'//'+location.host,
path.dirname(path.resolve(location.pathname.replace(/\/$/, '/index.html'), state.basePath))
);
};
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);
}
+1 -1
View File
@@ -14,7 +14,7 @@
{% 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 }}">
{% include "includes/summary.html" %}
<div class="book-body">
<div class="body-inner">