diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-04-24 18:52:37 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-04-24 18:52:37 +0200 |
commit | 19a1db8cb43431352d30dbc48aebb9cc8bf58eec (patch) | |
tree | 582b10a38610420b44fe91c3647c7fc448655d5c /lib/models/plugin.js | |
parent | c3275a4aa985710c0fcc9d3f7104bc5ebed2eb04 (diff) | |
download | gitbook-19a1db8cb43431352d30dbc48aebb9cc8bf58eec.zip gitbook-19a1db8cb43431352d30dbc48aebb9cc8bf58eec.tar.gz gitbook-19a1db8cb43431352d30dbc48aebb9cc8bf58eec.tar.bz2 |
Add base structure for templating
Diffstat (limited to 'lib/models/plugin.js')
-rw-r--r-- | lib/models/plugin.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/models/plugin.js b/lib/models/plugin.js index 6d322f4..2f791dc 100644 --- a/lib/models/plugin.js +++ b/lib/models/plugin.js @@ -1,5 +1,6 @@ var Immutable = require('immutable'); +var TemplateBlock = require('./templateBlock'); var PREFIX = require('../constants/pluginPrefix'); var DEFAULT_VERSION = '*'; @@ -73,6 +74,29 @@ Plugin.prototype.getHooks = function() { }; /** + Return map of filters + @return {Map<String:Function>} +*/ +Plugin.prototype.getFilters = function() { + return this.getContent().get('filters'); +}; + +/** + Return map of blocks + @return {List<TemplateBlock>} +*/ +Plugin.prototype.getBlocks = function() { + var blocks = this.getContent().get('blocks'); + + return blocks + .map(function(block, blockName) { + block.name = blockName; + return new TemplateBlock(block); + }) + .toList(); +}; + +/** Return a specific hook @param {String} name |