summaryrefslogtreecommitdiffstats
path: root/lib/page
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-21 01:02:20 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-21 01:02:20 +0100
commit2f15e26ffa9ca67007e9f23ac732fed0fcb109d9 (patch)
tree81c80adddaa8437e3ec7bda26bf62f8b62f014ff /lib/page
parentb4cdbc6534b12d4547898077b7d5b2fd2b2163d0 (diff)
downloadgitbook-2f15e26ffa9ca67007e9f23ac732fed0fcb109d9.zip
gitbook-2f15e26ffa9ca67007e9f23ac732fed0fcb109d9.tar.gz
gitbook-2f15e26ffa9ca67007e9f23ac732fed0fcb109d9.tar.bz2
Fix context for templating and page
Diffstat (limited to 'lib/page')
-rw-r--r--lib/page/index.js36
1 files changed, 22 insertions, 14 deletions
diff --git a/lib/page/index.js b/lib/page/index.js
index c4d2721..45b3598 100644
--- a/lib/page/index.js
+++ b/lib/page/index.js
@@ -6,6 +6,7 @@ var error = require('../utils/error');
var pathUtil = require('../utils/path');
var location = require('../utils/location');
var parsers = require('../parsers');
+var gitbook = require('../gitbook');
var HTMLPipeline = require('./html');
/*
@@ -109,21 +110,28 @@ Page.prototype.getContext = function() {
if (dir == 'neutral') dir = null;
}
- return {
- file: {
- path: this.path,
- mtime: this.mtime,
- type: this.type
+ return _.extend(
+ {
+ file: {
+ path: this.path,
+ mtime: this.mtime,
+ type: this.type
+ },
+ page: {
+ title: article? article.title : null,
+ next: next? next.getContext() : null,
+ previous: prev? prev.getContext() : null,
+ level: article? article.level : null,
+ content: this.content,
+ dir: dir
+ }
},
- page: {
- title: article? article.title : null,
- next: next? next.getContext() : null,
- previous: prev? prev.getContext() : null,
- level: article? article.level : null,
- content: this.content,
- dir: dir
- }
- };
+ gitbook.getContext(),
+ this.book.getContext(),
+ this.book.summary.getContext(),
+ this.book.glossary.getContext(),
+ this.book.config.getContext()
+ );
};
// Parse the page and return its content