blob: e82f679e1e11957ff9e912f2312ae518128f202d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
var WebsiteGenerator = require('../website');
var JSONUtils = require('../../json');
var Templating = require('../../templating');
var writeFile = require('../helper/writeFile');
/**
Finish the generation, generates the SUMMARY.html
@param {Output}
@return {Output}
*/
function onFinish(output) {
var book = output.getBook();
var options = output.getOptions();
var prefix = options.get('prefix');
var filePath = 'SUMMARY.html';
var engine = WebsiteGenerator.createTemplateEngine(output, filePath);
var context = JSONUtils.encodeOutput(output);
// Render the theme
return Templating.renderFile(engine, prefix + '/SUMMARY.html', context)
// Write it to the disk
.then(function(html) {
return writeFile(output, filePath, html);
});
}
module.exports = onFinish;
|