mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-05 09:56:22 +00:00
Aerate.
This commit is contained in:
parent
e191af1fb0
commit
1bc4263a46
@ -1,13 +1,17 @@
|
|||||||
###*
|
###*
|
||||||
Template helper definitions for Underscore.
|
Template helper definitions for Underscore.
|
||||||
@license MIT. Copyright (c) 2016 hacksalot (https://github.com/hacksalot)
|
@license MIT. See LICENSE.md for details.
|
||||||
@module handlebars-helpers.js
|
@module handlebars-helpers.js
|
||||||
###
|
###
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HANDLEBARS = require('handlebars')
|
HANDLEBARS = require('handlebars')
|
||||||
_ = require('underscore')
|
_ = require('underscore')
|
||||||
helpers = require('./generic-helpers')
|
helpers = require('./generic-helpers')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###*
|
###*
|
||||||
Register useful Underscore helpers.
|
Register useful Underscore helpers.
|
||||||
@method registerHelpers
|
@method registerHelpers
|
||||||
@ -22,3 +26,4 @@ module.exports = ( theme, opts, cssInfo, ctx, eng ) ->
|
|||||||
if _.isFunction hVal
|
if _.isFunction hVal
|
||||||
_.bind hVal, ctx
|
_.bind hVal, ctx
|
||||||
, @
|
, @
|
||||||
|
return
|
||||||
|
@ -8,7 +8,7 @@ Definition of the UnderscoreGenerator class.
|
|||||||
|
|
||||||
_ = require 'underscore'
|
_ = require 'underscore'
|
||||||
registerHelpers = require '../helpers/underscore-helpers'
|
registerHelpers = require '../helpers/underscore-helpers'
|
||||||
HMSTATUS = require '../core/status-codes'
|
|
||||||
|
|
||||||
|
|
||||||
###*
|
###*
|
||||||
@ -17,22 +17,27 @@ Perform template-based resume generation using Underscore.js.
|
|||||||
###
|
###
|
||||||
UnderscoreGenerator = module.exports =
|
UnderscoreGenerator = module.exports =
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
generateSimple: ( data, tpl ) ->
|
generateSimple: ( data, tpl ) ->
|
||||||
try
|
try
|
||||||
# Compile and run the Handlebars template.
|
# Compile and run the Handlebars template.
|
||||||
template = _.template( tpl );
|
tpl = _.template tpl
|
||||||
return template( data );
|
template data
|
||||||
catch
|
catch
|
||||||
|
HMS = require '../core/status-codes'
|
||||||
throw
|
throw
|
||||||
fluenterror: if template then HMSTATUS.invokeTemplate else HMSTATUS.compileTemplate,
|
fluenterror: HMS[if tpl then 'invokeTemplate' else 'compileTemplate']
|
||||||
inner: _error
|
inner: _error
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
generate: ( json, jst, format, cssInfo, opts, theme ) ->
|
generate: ( json, jst, format, cssInfo, opts, theme ) ->
|
||||||
|
|
||||||
# Tweak underscore's default template delimeters
|
# Tweak underscore's default template delimeters
|
||||||
delims = (opts.themeObj && opts.themeObj.delimeters) || opts.template;
|
delims = (opts.themeObj && opts.themeObj.delimeters) || opts.template;
|
||||||
if opts.themeObj && opts.themeObj.delimeters
|
if opts.themeObj && opts.themeObj.delimeters
|
||||||
delims = _.mapObject delims, (val,key) -> new RegExp( val, "ig")
|
delims = _.mapObject delims, (val,key) -> new RegExp val, "ig"
|
||||||
_.templateSettings = delims;
|
_.templateSettings = delims;
|
||||||
|
|
||||||
# Strip {# comments #}
|
# Strip {# comments #}
|
||||||
|
Loading…
Reference in New Issue
Block a user