mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-24 19:32:07 +00:00
Base template for glossary
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{% extends "site.html" %}
|
||||
|
||||
{% block title %}Glossary | {{ title }}{% endblock %}
|
||||
|
||||
{% block page_inner %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -24,6 +24,7 @@
|
||||
{% include "includes/book/header.html" %}
|
||||
<div class="page-wrapper" tabindex="-1">
|
||||
<div class="page-inner">
|
||||
{% block page_inner %}
|
||||
{% for section in content %}
|
||||
<section class="{{ section.type }}" id="section-{{ section.id }}">
|
||||
{% if section.type == "normal" %}
|
||||
@@ -35,6 +36,7 @@
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user