Call page hooks during transformation to HTML

This commit is contained in:
Samy Pessé
2016-02-25 14:26:27 +01:00
parent 9215edc0a0
commit 32f52f2d95
+15
View File
@@ -142,8 +142,19 @@ Page.prototype.toHTML = function(output) {
this.log.debug.ln('start parsing file', this.path);
function hook(name) {
return output.plugins.hook(name, that.getContext().page)
.then(function(result) {
if(result) that.update(result.content);
});
}
return this.read()
.then(function() {
return hook('page:before');
})
// Pre-process page with parser
.then(function() {
return that.parser.page.prepare(that.content)
@@ -198,6 +209,10 @@ Page.prototype.toHTML = function(output) {
.then(that.update);
})
.then(function() {
return hook('page');
})
// Return content itself
.then(function() {
return that.content;