mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-21 16:00:11 +00:00
Support no-escape option for Handlebars themes.
This commit is contained in:
parent
17259cedbf
commit
6b125ed907
@ -539,6 +539,15 @@ hackmyresume BUILD resume.json -d
|
||||
hackmyresume ANALYZE resume.json --debug
|
||||
```
|
||||
|
||||
### Disable Encoding
|
||||
|
||||
Use the `--no-escape` option to disable encoding in Handlebars themes. Note:
|
||||
this option has no effect for non-Handlebars themes.
|
||||
|
||||
```bash
|
||||
hackmyresume BUILD resume.json --no-escape
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
HackMyResume is a community-driven free and open source project under the MIT
|
||||
|
8
dist/cli/main.js
vendored
8
dist/cli/main.js
vendored
@ -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,
|
||||
|
5
dist/renderers/handlebars-generator.js
vendored
5
dist/renderers/handlebars-generator.js
vendored
@ -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
1
dist/verbs/build.js
vendored
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user