summaryrefslogtreecommitdiffstats
path: root/lib/page
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-15 09:55:12 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-15 09:55:12 +0100
commit1b19c6660303cb6ce98ac0ad76580f66b52985f1 (patch)
tree2e7df114dfe057e644667b1c719fb03b1eddfa20 /lib/page
parentd7077fc7db130d91f117dbf7ef01ec6ff5c6fb8e (diff)
downloadgitbook-1b19c6660303cb6ce98ac0ad76580f66b52985f1.zip
gitbook-1b19c6660303cb6ce98ac0ad76580f66b52985f1.tar.gz
gitbook-1b19c6660303cb6ce98ac0ad76580f66b52985f1.tar.bz2
Complete page.previous and page.next variables
Diffstat (limited to 'lib/page')
-rw-r--r--lib/page/index.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/page/index.js b/lib/page/index.js
index 54255dd..b3ff00f 100644
--- a/lib/page/index.js
+++ b/lib/page/index.js
@@ -107,6 +107,8 @@ Page.prototype.read = function() {
// This is used both for themes and page parsing
Page.prototype.getContext = function() {
var article = this.book.summary.getArticle(this);
+ var next = article? article.next() : null;
+ var prev = article? article.prev() : null;
return {
file: {
@@ -115,8 +117,8 @@ Page.prototype.getContext = function() {
},
page: {
title: article? article.title : null,
- next: article? article.next() : null,
- previous: article? article.prev() : null
+ next: next? next.getContext() : null,
+ previous: prev? prev.getContext() : null
}
};
};