diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-17 17:04:23 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-17 17:04:23 +0100 |
commit | d22c1f57e505eda6afe80fb6fe3a6b787d4aa699 (patch) | |
tree | 45d30347eb3dcc0d207247052cc2eb531149b262 /lib/output/website.js | |
parent | dac00be7b5a4aefa9cc3f63e5d94e729269bdfb0 (diff) | |
download | gitbook-d22c1f57e505eda6afe80fb6fe3a6b787d4aa699.zip gitbook-d22c1f57e505eda6afe80fb6fe3a6b787d4aa699.tar.gz gitbook-d22c1f57e505eda6afe80fb6fe3a6b787d4aa699.tar.bz2 |
Generate index.html instead of README.html
Diffstat (limited to 'lib/output/website.js')
-rw-r--r-- | lib/output/website.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/output/website.js b/lib/output/website.js index 41395e6..e25240c 100644 --- a/lib/output/website.js +++ b/lib/output/website.js @@ -63,6 +63,23 @@ WebsiteOutput.prototype.prepare = function() { .value(); that.env = new nunjucks.Environment(new nunjucks.FileSystemLoader(searchPaths)); + + that.env.addGlobal('__', function(s) { + // todo: i18n + return s; + }); + + // Transform an absolute path into a relative path + // using this.ctx.page.path + that.env.addFilter('resolveFile', function(s) { + // todo + return s; + }); + + // Transform a '.md' into a '.html' (README -> index) + that.env.addFilter('contentURL', function(s) { + return that.outputPath(s); + }); }); }; @@ -76,7 +93,7 @@ WebsiteOutput.prototype.onPage = function(page) { // Write the HTML file .then(function(html) { return that.writeFile( - page.withExtension('.html'), + that.outputPath(page.path), html ); }); |