summaryrefslogtreecommitdiffstats
path: root/lib/generators/site.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/generators/site.js')
-rw-r--r--lib/generators/site.js30
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/generators/site.js b/lib/generators/site.js
index 4ce34e2..c8b9e91 100644
--- a/lib/generators/site.js
+++ b/lib/generators/site.js
@@ -12,6 +12,9 @@ var pageUtil = require("../utils/page");
var Generator = function() {
BaseGenerator.apply(this, arguments);
+ // revision
+ this.revision = new Date();
+
// Style to integrates i nthe output
this.styles = ["website"];
@@ -21,20 +24,20 @@ var Generator = function() {
util.inherits(Generator, BaseGenerator);
// Prepare the genertor
-BaseGenerator.prototype.load = function() {
+Generator.prototype.prepare = function() {
var that = this;
- return BaseGenerator.prototype.load.apply(this)
+ return BaseGenerator.prototype.prepare.apply(this)
.then(function() {
- return that.loadStyles();
+ return that.prepareStyles();
})
.then(function() {
- return that.loadTemplates();
+ return that.prepareTemplates();
});
};
-// Load all styles
-Generator.prototype.loadStyles = function() {
+// Prepare all styles
+Generator.prototype.prepareStyles = function() {
var that = this;
this.styles = _.chain(this.styles)
.map(function(style) {
@@ -48,8 +51,8 @@ Generator.prototype.loadStyles = function() {
.value();
};
-// Load template engine
-Generator.prototype.loadTemplates = function() {
+// Prepare template engine
+Generator.prototype.prepareTemplates = function() {
this.pageTemplate = this.plugins.template("site:page") || path.resolve(this.templatesRoot, 'page.html');
this.langsTemplate = this.plugins.template("site:langs") || path.resolve(this.templatesRoot, 'langs.html');
this.glossaryTemplate = this.plugins.template("site:glossary") || path.resolve(this.templatesRoot, 'templates/website/glossary.html');
@@ -86,8 +89,17 @@ Generator.prototype.finish = function() {
// Convert an input file
Generator.prototype.writeParsedFile = function(page) {
- var output = links.changeExtension(page.path, ".json");
+ var that = this;
+
+ var output = links.changeExtension(page.path, ".html");
output = path.join(that.options.output, output);
+
+ return that.normalizePage(page)
+ .then(function() {
+ return that._writeTemplate(that.pageTemplate, {
+
+ }, output);
+ });
};
// Write the index for langs