summaryrefslogtreecommitdiffstats
path: root/lib/generate/site/index.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2014-08-17 11:26:20 -0700
committerSamy Pessé <samypesse@gmail.com>2014-08-17 11:26:20 -0700
commit6b0ad22b191d92a07976bc0f8467691191bb779f (patch)
treebd90b6be08fee3c6a1bae3d75a57135d8dc836be /lib/generate/site/index.js
parent17f40540ae6c05ff2f74ba8056331e58db950a8a (diff)
downloadgitbook-6b0ad22b191d92a07976bc0f8467691191bb779f.zip
gitbook-6b0ad22b191d92a07976bc0f8467691191bb779f.tar.gz
gitbook-6b0ad22b191d92a07976bc0f8467691191bb779f.tar.bz2
Base template for glossary
Diffstat (limited to 'lib/generate/site/index.js')
-rw-r--r--lib/generate/site/index.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/generate/site/index.js b/lib/generate/site/index.js
index 6f29991..1846da1 100644
--- a/lib/generate/site/index.js
+++ b/lib/generate/site/index.js
@@ -31,6 +31,9 @@ Generator.prototype.loadTemplates = function() {
this.langsTemplate = swig.compileFile(
this.plugins.template("langs") || path.resolve(this.options.theme, 'templates/langs.html')
);
+ this.glossaryTemplate = swig.compileFile(
+ this.plugins.template("glossary") || path.resolve(this.options.theme, 'templates/glossary.html')
+ );
};
// Load plugins
@@ -60,6 +63,8 @@ Generator.prototype._writeTemplate = function(tpl, options, output, interpolate)
githubId: that.options.github,
githubHost: that.options.githubHost,
+ glossary: that.options.glossary,
+
summary: that.options.summary,
allNavigation: that.options.navigation,
@@ -172,6 +177,17 @@ Generator.prototype.langsIndex = function(langs) {
});
};
+// Generate glossary
+Generator.prototype.writeGlossary = function() {
+ var that = this;
+ var basePath = ".";
+
+ return this._writeTemplate(this.glossaryTemplate, {
+ basePath: basePath,
+ staticBase: path.join(basePath, "gitbook"),
+ }, path.join(this.options.output, "GLOSSARY.html"));
+};
+
// Copy assets
Generator.prototype.copyAssets = function() {
var that = this;
@@ -205,6 +221,7 @@ Generator.prototype.writeSearchIndex = function() {
Generator.prototype.finish = function() {
return this.copyAssets()
.then(this.copyCover)
+ .then(this.writeGlossary)
.then(this.writeSearchIndex);
};