1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-03 04:47:07 +01:00

Support no-escape option for Handlebars themes.

This commit is contained in:
hacksalot
2018-01-29 05:21:46 -05:00
parent 17259cedbf
commit 6b125ed907
7 changed files with 25 additions and 6 deletions

View File

@ -123,6 +123,7 @@ main = module.exports = ( rawArgs, exitCallback ) ->
.option('--no-sort', 'Sort resume sections by date', false)
.option('--tips', 'Display theme tips and warnings.', false)
.option('--private', 'Include resume fields marked as private', false)
.option('--no-escape', "Turn off encoding in Handlebars themes.", false)
.description('Generate resume to multiple formats')
.action(( sources, targets, options ) ->
x = splitSrcDest.call( this );
@ -238,12 +239,14 @@ initOptions = ( ar ) ->
isSilent = _.some args, (v) -> v == '-s' || v == '--silent'
isAssert = _.some args, (v) -> v == '-a' || v == '--assert'
isMono = _.some args, (v) -> v == '--no-color'
isNoEscape = _.some args, (v) -> v == '--no-escape'
return {
color: !isMono,
debug: isDebug,
silent: isSilent,
assert: isAssert,
noescape: isNoEscape,
orgVerb: oVerb,
verb: verb,
json: oJSON,

View File

@ -29,8 +29,8 @@ HandlebarsGenerator = module.exports =
try
# Compile and run the Handlebars template.
template = HANDLEBARS.compile tpl, {
strict: false, assumeObjects: false, noEscape: true}
template = HANDLEBARS.compile tpl,
strict: false, assumeObjects: false, noEscape: data.opts.noescape || false
return template data
catch
throw

View File

@ -170,6 +170,7 @@ _prep = ( src, dst, opts ) ->
_opts.theme = (opts.theme && opts.theme.toLowerCase().trim()) || 'modern';
_opts.prettify = opts.prettify is true
_opts.private = opts.private is true
_opts.noescape = opts.noescape is true
_opts.css = opts.css
_opts.pdf = opts.pdf
_opts.wrap = opts.wrap || 60