diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-10-27 12:18:04 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-10-27 12:18:04 +0100 |
commit | 0521defb635075165699c8729ef849e69492b3b5 (patch) | |
tree | 1b3fc2b1ffad63010ddae8ba7c7061897ecef78d | |
parent | ea4d96610f98da3f692dfd424e2840ab30e61e36 (diff) | |
download | gitbook-0521defb635075165699c8729ef849e69492b3b5.zip gitbook-0521defb635075165699c8729ef849e69492b3b5.tar.gz gitbook-0521defb635075165699c8729ef849e69492b3b5.tar.bz2 |
Add 'chapterTitle' to gitbook.state api
-rw-r--r-- | theme/javascript/state.js | 3 | ||||
-rw-r--r-- | theme/templates/website/page.html | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/theme/javascript/state.js b/theme/javascript/state.js index 34e94fe..5e9083f 100644 --- a/theme/javascript/state.js +++ b/theme/javascript/state.js @@ -17,6 +17,9 @@ state.update = function(dom) { // 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.protocol+'//'+location.host, diff --git a/theme/templates/website/page.html b/theme/templates/website/page.html index c6db959..5b609ae 100644 --- a/theme/templates/website/page.html +++ b/theme/templates/website/page.html @@ -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-filepath="{{ progress.current.path }}" 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"> |