1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-02 20:37:08 +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

8
dist/cli/main.js vendored
View File

@ -87,7 +87,7 @@ Definition of the `main` function.
dst = sources && sources.length > 1 ? [sources.pop()] : [];
execute.call(this, sources, dst, this.opts(), logMsg);
});
program.command('build').alias('generate').option('-t --theme <theme>', 'Theme name or path').option('-n --no-prettify', 'Disable HTML prettification', true).option('-c --css <option>', 'CSS linking / embedding').option('-p --pdf <engine>', 'PDF generation engine').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).description('Generate resume to multiple formats').action(function(sources, targets, options) {
program.command('build').alias('generate').option('-t --theme <theme>', 'Theme name or path').option('-n --no-prettify', 'Disable HTML prettification', true).option('-c --css <option>', 'CSS linking / embedding').option('-p --pdf <engine>', 'PDF generation engine').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(function(sources, targets, options) {
var x;
x = splitSrcDest.call(this);
execute.call(this, x.src, x.dst, this.opts(), logMsg);
@ -163,7 +163,7 @@ Definition of the `main` function.
initOptions = function(ar) {
oVerb;
var args, cleanArgs, inf, isAssert, isDebug, isMono, isSilent, oJSON, oVerb, optStr, optsIdx, verb, vidx;
var args, cleanArgs, inf, isAssert, isDebug, isMono, isNoEscape, isSilent, oJSON, oVerb, optStr, optsIdx, verb, vidx;
verb = '';
args = ar.slice();
cleanArgs = args.slice(2);
@ -212,11 +212,15 @@ Definition of the `main` function.
isMono = _.some(args, function(v) {
return v === '--no-color';
});
isNoEscape = _.some(args, function(v) {
return v === '--no-escape';
});
return {
color: !isMono,
debug: isDebug,
silent: isSilent,
assert: isAssert,
noescape: isNoEscape,
orgVerb: oVerb,
verb: verb,
json: oJSON,

View File

@ -34,12 +34,13 @@ Definition of the HandlebarsGenerator class.
HandlebarsGenerator = module.exports = {
generateSimple: function(data, tpl) {
var template;
var noesc, template;
try {
noesc = data.opts.noescape || false;
template = HANDLEBARS.compile(tpl, {
strict: false,
assumeObjects: false,
noEscape: true
noEscape: noesc
});
return template(data);
} catch (_error) {

1
dist/verbs/build.js vendored
View File

@ -237,6 +237,7 @@ Implementation of the 'build' verb for HackMyResume.
_opts.theme = (opts.theme && opts.theme.toLowerCase().trim()) || 'modern';
_opts.prettify = opts.prettify === true;
_opts["private"] = opts["private"] === true;
_opts.noescape = opts.noescape === true;
_opts.css = opts.css;
_opts.pdf = opts.pdf;
_opts.wrap = opts.wrap || 60;