Extend templates filters

Fully remove mathjax from plugins
This commit is contained in:
Samy Pessé
2015-01-27 12:56:04 +01:00
parent 54e1be1e77
commit 870ca4da0c
3 changed files with 12 additions and 1 deletions
+3
View File
@@ -348,6 +348,9 @@ Book.prototype.parsePlugins = function() {
return Plugin.normalize(pluginsList)
.then(function(_plugins) {
that.plugins = _plugins;
// Add filters
that.template.addFilters(that.plugins.filters);
});
};
+1 -1
View File
@@ -6,7 +6,7 @@ var npmi = require('npmi');
var fs = require("./utils/fs");
// Default plugins added to each books
var defaultsPlugins = ["mathjax"];
var defaultsPlugins = [];
// Normalize a list of plugins to use
function normalizePluginsList(plugins) {
+8
View File
@@ -66,6 +66,14 @@ var TemplateEngine = function(book) {
);
};
// Add filters
TemplateEngine.prototype.addFilters = function(filters) {
_.each(filters, function(func, key) {
this.book.log.debug.ln("add filter '"+key+"'");
this.env.addFilter(key, func);
}, this);
};
// Render a string from the book
TemplateEngine.prototype.renderString = function(content, context, options) {
var context = _.extend({}, context, {