summaryrefslogtreecommitdiffstats
path: root/lib/output
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/output
parentb4cdbc6534b12d4547898077b7d5b2fd2b2163d0 (diff)
downloadgitbook-2f15e26ffa9ca67007e9f23ac732fed0fcb109d9.zip
gitbook-2f15e26ffa9ca67007e9f23ac732fed0fcb109d9.tar.gz
gitbook-2f15e26ffa9ca67007e9f23ac732fed0fcb109d9.tar.bz2
Fix context for templating and page
Diffstat (limited to 'lib/output')
-rw-r--r--lib/output/base.js12
-rw-r--r--lib/output/json.js2
-rw-r--r--lib/output/website.js2
3 files changed, 2 insertions, 14 deletions
diff --git a/lib/output/base.js b/lib/output/base.js
index f5a8e4f..4190559 100644
--- a/lib/output/base.js
+++ b/lib/output/base.js
@@ -175,18 +175,6 @@ Output.prototype.onResolveTemplate = function(from, to) {
// ---- Utilities ----
-// Return the complete templating context for a page
-Output.prototype.getPageContext = function(page) {
- return _.extend(
- page.getContext(),
- gitbook.getContext(),
- this.book.getContext(),
- this.book.summary.getContext(),
- this.book.glossary.getContext(),
- this.book.config.getContext()
- );
-};
-
// Resolve a file path in the context of a specific page
// Result is an "absolute path relative to the output folder"
Output.prototype.resolveForPage = function(page, href) {
diff --git a/lib/output/json.js b/lib/output/json.js
index 5805579..86a2307 100644
--- a/lib/output/json.js
+++ b/lib/output/json.js
@@ -16,7 +16,7 @@ JSONOutput.prototype.onPage = function(page) {
// Write as json
.then(function() {
- var json = that.getPageContext(page);
+ var json = page.getContext();
// Delete some private properties
delete json.config;
diff --git a/lib/output/website.js b/lib/output/website.js
index d856229..1cdd4a6 100644
--- a/lib/output/website.js
+++ b/lib/output/website.js
@@ -138,7 +138,7 @@ WebsiteOutput.prototype.onPage = function(page) {
// Render the page template with the same context as the json output
.then(function() {
- return that.render('page', that.getPageContext(page));
+ return that.render('page', page.getContext());
})
// Write the HTML file