mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-10-03 20:20:35 +00:00
Extend templates filters
Fully remove mathjax from plugins
This commit is contained in:
@@ -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);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user