mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-05 09:56:22 +00:00
917fd8e3f3
Rebind Handlebars helpers to drop the pesky options hash for standalone helpers that don't need it. Move block helpers (which do need the Handlebars options/context) to a separate file for special handling.
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
|
|
/**
|
|
Template helper definitions for Handlebars.
|
|
@license MIT. See LICENSE.md for details.
|
|
@module handlebars-helpers.js
|
|
*/
|
|
|
|
(function() {
|
|
var HANDLEBARS, _, blockHelpers, helpers;
|
|
|
|
HANDLEBARS = require('handlebars');
|
|
|
|
_ = require('underscore');
|
|
|
|
helpers = require('./generic-helpers');
|
|
|
|
blockHelpers = require('./block-helpers');
|
|
|
|
|
|
/**
|
|
Register useful Handlebars helpers.
|
|
@method registerHelpers
|
|
*/
|
|
|
|
module.exports = function(theme, opts) {
|
|
var wrappedHelpers;
|
|
helpers.theme = theme;
|
|
helpers.opts = opts;
|
|
helpers.type = 'handlebars';
|
|
wrappedHelpers = _.mapObject(helpers, function(hVal, hKey) {
|
|
if (_.isFunction(hVal)) {
|
|
_.wrap(hVal, function(func) {
|
|
var args;
|
|
args = Array.prototype.slice.call(arguments);
|
|
args.shift();
|
|
args.pop();
|
|
return func.apply(this, args);
|
|
});
|
|
}
|
|
return hVal;
|
|
}, this);
|
|
HANDLEBARS.registerHelper(wrappedHelpers);
|
|
HANDLEBARS.registerHelper(blockHelpers);
|
|
};
|
|
|
|
}).call(this);
|
|
|
|
//# sourceMappingURL=handlebars-helpers.js.map
|