summaryrefslogtreecommitdiffstats
path: root/lib/generate/page/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/generate/page/index.js')
-rw-r--r--lib/generate/page/index.js25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/generate/page/index.js b/lib/generate/page/index.js
index c2f4484..bd9b233 100644
--- a/lib/generate/page/index.js
+++ b/lib/generate/page/index.js
@@ -2,22 +2,12 @@ var _ = require("lodash");
var util = require("util");
var path = require("path");
var Q = require("q");
-var swig = require('swig');
-var hljs = require('highlight.js');
+var swig = require("../template");
var fs = require("../fs");
var parse = require("../../parse");
var BaseGenerator = require("../site");
-// Swig filter: highlight coloration
-swig.setFilter('code', function(code, lang) {
- try {
- return hljs.highlight(lang, code).value;
- } catch(e) {
- return hljs.highlightAuto(code).value;
- }
-});
-
/*
* This generator will generate a simple index.html which can be converted as a PDF
@@ -61,22 +51,35 @@ Generator.prototype.convertFile = function(content, input) {
});
};
+// Generate languages index
+Generator.prototype.langsIndex = function(langs) {
+ return Q();
+};
+
Generator.prototype.finish = function() {
var that = this;
var basePath = ".";
var output = path.join(this.options.output, "index.html");
+ var progress = parse.progress(this.options.navigation, "README.md");
+
return Q()
// Generate html
.then(function(pages) {
return that._writeTemplate(that.template, {
pages: that.pages,
+ progress: progress,
basePath: basePath,
staticBase: path.join(basePath, "gitbook"),
}, output);
})
+ // Copy cover
+ .then(function() {
+ return that.copyCover();
+ })
+
// Copy assets
.then(function() {
return fs.copy(