1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-07-09 19:51:07 +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

@ -30,7 +30,9 @@ HandlebarsGenerator = module.exports =
try
# Compile and run the Handlebars template.
template = HANDLEBARS.compile tpl,
strict: false, assumeObjects: false, noEscape: data.opts.noescape
strict: false
assumeObjects: false
noEscape: data.opts.noescape
return template data
catch
throw
@ -42,10 +44,6 @@ HandlebarsGenerator = module.exports =
generate: ( json, jst, format, curFmt, opts, theme ) ->
# Set up partials and helpers
registerPartials format, theme
registerHelpers theme, opts
# Preprocess text
encData = json
if format == 'html' || format == 'pdf'
@ -53,6 +51,10 @@ HandlebarsGenerator = module.exports =
if( format == 'doc' )
encData = json.xmlify()
# Set up partials and helpers
registerPartials format, theme
registerHelpers theme, encData, opts
# Set up the context
ctx =
r: encData