summaryrefslogtreecommitdiffstats
path: root/lib/generate/page/index.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2014-09-17 15:02:22 +0200
committerSamy Pessé <samypesse@gmail.com>2014-09-17 15:02:22 +0200
commitd69cc746472684195f5b628d0ee4dc79e10f59e1 (patch)
treec668eba1bc444a9d1e0f6a461a0759d234a1eb35 /lib/generate/page/index.js
parentbe0a4f08e9a45efc4766632a787adbb187e931af (diff)
parentf83874a9ca5877c9b5417e1603df9c9d3ffe19f2 (diff)
downloadgitbook-d69cc746472684195f5b628d0ee4dc79e10f59e1.zip
gitbook-d69cc746472684195f5b628d0ee4dc79e10f59e1.tar.gz
gitbook-d69cc746472684195f5b628d0ee4dc79e10f59e1.tar.bz2
Merge pull request #440 from GitbookIO/feature/ebookplugins
Apply plugins to ebook generation
Diffstat (limited to 'lib/generate/page/index.js')
-rw-r--r--lib/generate/page/index.js25
1 files changed, 7 insertions, 18 deletions
diff --git a/lib/generate/page/index.js b/lib/generate/page/index.js
index bd9b233..9e48a5e 100644
--- a/lib/generate/page/index.js
+++ b/lib/generate/page/index.js
@@ -15,6 +15,9 @@ var BaseGenerator = require("../site");
var Generator = function() {
BaseGenerator.apply(this, arguments);
+ // Base for assets in plugins
+ this.pluginAssetsBase = "ebook";
+
// List of pages content
this.pages = {};
};
@@ -34,20 +37,9 @@ Generator.prototype.convertFile = function(content, input) {
progress: parse.progress(this.options.navigation, input)
};
- return Q()
- .then(function() {
- return parse.page(content, {
- repo: that.options.githubId,
- dir: path.dirname(input) || '/',
- outdir: './',
- singleFile: true
- });
- })
- .then(function(sections) {
- json.content = sections;
- })
- .then(function() {
- that.pages[input] = json;
+ return this.prepareFile(content, input)
+ .then(function(page) {
+ that.pages[input] = page;
});
};
@@ -82,10 +74,7 @@ Generator.prototype.finish = function() {
// Copy assets
.then(function() {
- return fs.copy(
- path.join(that.options.theme, "assets"),
- path.join(that.options.output, "gitbook")
- );
+ return that.copyAssets();
});
};