summaryrefslogtreecommitdiffstats
path: root/lib/generators/site.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/generators/site.js')
-rw-r--r--lib/generators/site.js22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/generators/site.js b/lib/generators/site.js
index d5a0c08..51a6cb3 100644
--- a/lib/generators/site.js
+++ b/lib/generators/site.js
@@ -89,6 +89,7 @@ Generator.prototype.prepareTemplates = function() {
Generator.prototype.finish = function() {
return this.copyAssets()
.then(this.copyCover)
+ .then(this.writeGlossary)
};
// Normalize a link to .html and convert README -> index
@@ -131,16 +132,21 @@ Generator.prototype.writeParsedFile = function(page) {
// Write the index for langs
Generator.prototype.langsIndex = function(langs) {
var that = this;
- var basePath = ".";
return this._writeTemplate(this.langsTemplate, {
- langs: langs,
-
- basePath: basePath,
- staticBase: path.join(basePath, "gitbook"),
+ langs: langs
}, path.join(this.options.output, "index.html"));
};
+// Write glossary
+Generator.prototype.writeGlossary = function() {
+ var that = this;
+
+ // No glossary
+ if (this.book.glossary.length == 0) return Q();
+
+ return this._writeTemplate(this.glossaryTemplate, {}, path.join(this.options.output, "GLOSSARY.html"));
+};
// Convert a page into a normalized data set
Generator.prototype.normalizePage = function(page) {
@@ -189,7 +195,10 @@ Generator.prototype._writeTemplate = function(tpl, options, output, interpolate)
pluginsConfig: JSON.stringify(that.options.pluginsConfig),
htmlSnippet: _.partialRight(that.plugins.html, that, options),
- options: that.options
+ options: that.options,
+
+ basePath: ".",
+ staticBase: path.join(".", "gitbook"),
}, options)
);
})
@@ -202,7 +211,6 @@ Generator.prototype._writeTemplate = function(tpl, options, output, interpolate)
});
};
-
// Copy assets
Generator.prototype.copyAssets = function() {
var that = this;