From 6b0ad22b191d92a07976bc0f8467691191bb779f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Sun, 17 Aug 2014 11:26:20 -0700 Subject: [PATCH] Base template for glossary --- lib/generate/site/index.js | 17 +++++++++++++++++ theme/templates/glossary.html | 7 +++++++ theme/templates/site.html | 2 ++ 3 files changed, 26 insertions(+) create mode 100644 theme/templates/glossary.html diff --git a/lib/generate/site/index.js b/lib/generate/site/index.js index 6f299914a..1846da10e 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); }; diff --git a/theme/templates/glossary.html b/theme/templates/glossary.html new file mode 100644 index 000000000..73ef4d62b --- /dev/null +++ b/theme/templates/glossary.html @@ -0,0 +1,7 @@ +{% extends "site.html" %} + +{% block title %}Glossary | {{ title }}{% endblock %} + +{% block page_inner %} + +{% endblock %} diff --git a/theme/templates/site.html b/theme/templates/site.html index d754a9a00..7db74491c 100644 --- a/theme/templates/site.html +++ b/theme/templates/site.html @@ -24,6 +24,7 @@ {% include "includes/book/header.html" %}
+ {% block page_inner %} {% for section in content %}
{% if section.type == "normal" %} @@ -35,6 +36,7 @@ {% endif %}
{% endfor %} + {% endblock %}