Compare commits

...

6 Commits

Author SHA1 Message Date
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
6 changed files with 34 additions and 6 deletions
+4
View File
@@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## 2.5.0
- Add `chapterTitle` and `filepath` to `gitbook.state` JS API
- Fix compatibility with plugins `<2.5.0`
## 2.5.0-beta.7
- Use Arial as default font for PDFs
- Client side API provides `gitbook.state.root`
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "gitbook",
"version": "2.5.0-beta.7",
"version": "2.5.0",
"homepage": "https://www.gitbook.com",
"description": "Library and cmd utility to generate GitBooks",
"main": "lib/index.js",
+14 -2
View File
@@ -24426,7 +24426,7 @@ var gitbook = {
// Modules mapping for plugins
var MODULES = {
'gitbook': gitbook,
'jQuery': $,
'jquery': $,
'lodash': _
};
@@ -24435,6 +24435,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');
}
@@ -24735,10 +24736,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, state.basePath))
);
};
state.update($);
+2 -1
View File
@@ -59,7 +59,7 @@ var gitbook = {
// Modules mapping for plugins
var MODULES = {
'gitbook': gitbook,
'jQuery': $,
'jquery': $,
'lodash': _
};
@@ -68,6 +68,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');
}
+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, state.basePath))
);
};
state.update($);
+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">