summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/generators/website.js1
-rw-r--r--lib/index.js2
-rw-r--r--lib/utils/progress.js2
-rw-r--r--theme/assets/website/app.js8
-rw-r--r--theme/javascript/state.js8
-rw-r--r--theme/templates/website/page.html8
6 files changed, 24 insertions, 5 deletions
diff --git a/lib/generators/website.js b/lib/generators/website.js
index 18ec65d..ecfd98c 100644
--- a/lib/generators/website.js
+++ b/lib/generators/website.js
@@ -208,6 +208,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,
diff --git a/lib/index.js b/lib/index.js
index 5a93a54..a23ec3f 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -1,4 +1,4 @@
-/*eslint no-console: 0*/
+/* eslint no-console: 0 */
var Q = require('q');
var _ = require('lodash');
diff --git a/lib/utils/progress.js b/lib/utils/progress.js
index 78821ad..8dda892 100644
--- a/lib/utils/progress.js
+++ b/lib/utils/progress.js
@@ -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) {
diff --git a/theme/assets/website/app.js b/theme/assets/website/app.js
index 2434ad2..c9353c4 100644
--- a/theme/assets/website/app.js
+++ b/theme/assets/website/app.js
@@ -24743,6 +24743,9 @@ state.update = function(dom) {
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');
@@ -24752,11 +24755,14 @@ state.update = function(dom) {
// Title of the chapter
state.chapterTitle = $book.data('chapter-title');
- // Absolute url to the root of the book
+ // 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))
);
+
+ // Absolute root to the language (for multilingual book)
+ state.bookRoot = state.innerlanguage? url.resolve(state.root, '..') : state.root;
};
state.update($);
diff --git a/theme/javascript/state.js b/theme/javascript/state.js
index fb91f7a..a6a7877 100644
--- a/theme/javascript/state.js
+++ b/theme/javascript/state.js
@@ -11,6 +11,9 @@ state.update = function(dom) {
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');
@@ -20,11 +23,14 @@ state.update = function(dom) {
// Title of the chapter
state.chapterTitle = $book.data('chapter-title');
- // Absolute url to the root of the book
+ // 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))
);
+
+ // Absolute root to the language (for multilingual book)
+ state.bookRoot = state.innerlanguage? url.resolve(state.root, '..') : state.root;
};
state.update($);
diff --git a/theme/templates/website/page.html b/theme/templates/website/page.html
index 5b609ae..6c29164 100644
--- a/theme/templates/website/page.html
+++ b/theme/templates/website/page.html
@@ -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-chapter-title="{{ progress.current.title }}" 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 }}"
+ data-innerlanguage="{{ innerlanguage }}">
{% include "includes/summary.html" %}
<div class="book-body">
<div class="body-inner">