1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-02 20:37:08 +01:00

feat: improve template helper wiring

This commit is contained in:
hacksalot
2018-02-07 05:49:02 -05:00
parent 2346562428
commit 38a073b09a
4 changed files with 27 additions and 14 deletions

View File

@ -26,7 +26,7 @@ Template helper definitions for Handlebars.
@method registerHelpers
*/
module.exports = function(theme, opts) {
module.exports = function(theme, rez, opts) {
var curGlob, ex, glob, slash, wrappedHelpers;
helpers.theme = theme;
helpers.opts = opts;
@ -37,7 +37,7 @@ Template helper definitions for Handlebars.
var args;
args = Array.prototype.slice.call(arguments);
args.shift();
args.pop();
args[args.length - 1] = rez;
return func.apply(this, args);
});
}

View File

@ -51,8 +51,6 @@ Definition of the HandlebarsGenerator class.
},
generate: function(json, jst, format, curFmt, opts, theme) {
var ctx, encData;
registerPartials(format, theme);
registerHelpers(theme, opts);
encData = json;
if (format === 'html' || format === 'pdf') {
encData = json.markdownify();
@ -60,6 +58,8 @@ Definition of the HandlebarsGenerator class.
if (format === 'doc') {
encData = json.xmlify();
}
registerPartials(format, theme);
registerHelpers(theme, encData, opts);
ctx = {
r: encData,
RAW: json,