summaryrefslogtreecommitdiffstats
path: root/lib/generate/page
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2014-05-29 18:28:09 +0200
committerSamy Pessé <samypesse@gmail.com>2014-05-29 18:28:09 +0200
commitf4a17b182fb28f686693659983d82797ce93330b (patch)
tree7e53cec1b9db40190939f8e22a845d4fa2d5b865 /lib/generate/page
parent5c3b345fa69f577ebcc752ad626cd60f6bd412c6 (diff)
downloadgitbook-f4a17b182fb28f686693659983d82797ce93330b.zip
gitbook-f4a17b182fb28f686693659983d82797ce93330b.tar.gz
gitbook-f4a17b182fb28f686693659983d82797ce93330b.tar.bz2
Improve ebook generation (toc, ...)
Diffstat (limited to 'lib/generate/page')
-rw-r--r--lib/generate/page/index.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/generate/page/index.js b/lib/generate/page/index.js
index c2f4484..7e6826d 100644
--- a/lib/generate/page/index.js
+++ b/lib/generate/page/index.js
@@ -18,6 +18,11 @@ swig.setFilter('code', function(code, lang) {
}
});
+// Convert a level into a deep level
+swig.setFilter('lvl', function(lvl) {
+ return lvl.split(".").length;
+});
+
/*
* This generator will generate a simple index.html which can be converted as a PDF
@@ -66,11 +71,14 @@ Generator.prototype.finish = function() {
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"),