diff options
-rw-r--r-- | lib/generate/page/index.js | 10 | ||||
-rw-r--r-- | theme/templates/ebook/glossary.html | 15 | ||||
-rw-r--r-- | theme/templates/ebook/summary.html | 4 |
3 files changed, 28 insertions, 1 deletions
diff --git a/lib/generate/page/index.js b/lib/generate/page/index.js index 8e44187..a926d13 100644 --- a/lib/generate/page/index.js +++ b/lib/generate/page/index.js @@ -26,6 +26,9 @@ Generator.prototype.loadTemplates = function() { this.summaryTemplate = swig.compileFile( this.plugins.template("ebook:sumary") || path.resolve(this.options.theme, 'templates/ebook/summary.html') ); + this.glossaryTemplate = swig.compileFile( + this.plugins.template("ebook:glossary") || path.resolve(this.options.theme, 'templates/ebook/glossary.html') + ); }; // Generate table of contents @@ -46,7 +49,7 @@ Generator.prototype.finish = function() { var output = path.join(this.options.output, "index.html"); var progress = parse.progress(this.options.navigation, "README.md"); - + return Q() // Write table of contents @@ -54,6 +57,11 @@ Generator.prototype.finish = function() { return that.writeToc(); }) + // Write glossary + .then(function() { + return that.writeGlossary(); + }) + // Copy cover .then(function() { return that.copyCover(); diff --git a/theme/templates/ebook/glossary.html b/theme/templates/ebook/glossary.html new file mode 100644 index 0000000..8076c4d --- /dev/null +++ b/theme/templates/ebook/glossary.html @@ -0,0 +1,15 @@ +{% extends "./layout.html" %} + +{% block title %}Glossary | {{ title }}{% endblock %} + +{% block content %} +<div class="page page-toc"> + <h1>Glossary</h1> + {% for item in glossaryIndex %} + <section class="normal glossary" id="{{ item.id }}"> + <h2><a href="#{{ item.id }}">{{ item.name }}</a></h2> + <p>{{ item.description }}</p> + </section> + {% endfor %} +</div> +{% endblock %} diff --git a/theme/templates/ebook/summary.html b/theme/templates/ebook/summary.html index 85388f9..dfbba2c 100644 --- a/theme/templates/ebook/summary.html +++ b/theme/templates/ebook/summary.html @@ -40,6 +40,10 @@ <h1>Table of Contents</h1> <ol> {{ articles(summary.chapters) }} + + {% if glossary.length > 0 %} + <li><a href="{{ basePath }}/GLOSSARY.html">Glossary</a></li> + {% endif %} </ol> </div> {% endblock %} |