mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 00:10:15 +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
|
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
|
## Contributing
|
||||||
|
|
||||||
HackMyResume is a community-driven free and open source project under the MIT
|
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()] : [];
|
dst = sources && sources.length > 1 ? [sources.pop()] : [];
|
||||||
execute.call(this, sources, dst, this.opts(), logMsg);
|
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;
|
var x;
|
||||||
x = splitSrcDest.call(this);
|
x = splitSrcDest.call(this);
|
||||||
execute.call(this, x.src, x.dst, this.opts(), logMsg);
|
execute.call(this, x.src, x.dst, this.opts(), logMsg);
|
||||||
@ -163,7 +163,7 @@ Definition of the `main` function.
|
|||||||
|
|
||||||
initOptions = function(ar) {
|
initOptions = function(ar) {
|
||||||
oVerb;
|
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 = '';
|
verb = '';
|
||||||
args = ar.slice();
|
args = ar.slice();
|
||||||
cleanArgs = args.slice(2);
|
cleanArgs = args.slice(2);
|
||||||
@ -212,11 +212,15 @@ Definition of the `main` function.
|
|||||||
isMono = _.some(args, function(v) {
|
isMono = _.some(args, function(v) {
|
||||||
return v === '--no-color';
|
return v === '--no-color';
|
||||||
});
|
});
|
||||||
|
isNoEscape = _.some(args, function(v) {
|
||||||
|
return v === '--no-escape';
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
color: !isMono,
|
color: !isMono,
|
||||||
debug: isDebug,
|
debug: isDebug,
|
||||||
silent: isSilent,
|
silent: isSilent,
|
||||||
assert: isAssert,
|
assert: isAssert,
|
||||||
|
noescape: isNoEscape,
|
||||||
orgVerb: oVerb,
|
orgVerb: oVerb,
|
||||||
verb: verb,
|
verb: verb,
|
||||||
json: oJSON,
|
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 = {
|
HandlebarsGenerator = module.exports = {
|
||||||
generateSimple: function(data, tpl) {
|
generateSimple: function(data, tpl) {
|
||||||
var template;
|
var noesc, template;
|
||||||
try {
|
try {
|
||||||
|
noesc = data.opts.noescape || false;
|
||||||
template = HANDLEBARS.compile(tpl, {
|
template = HANDLEBARS.compile(tpl, {
|
||||||
strict: false,
|
strict: false,
|
||||||
assumeObjects: false,
|
assumeObjects: false,
|
||||||
noEscape: true
|
noEscape: noesc
|
||||||
});
|
});
|
||||||
return template(data);
|
return template(data);
|
||||||
} catch (_error) {
|
} 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.theme = (opts.theme && opts.theme.toLowerCase().trim()) || 'modern';
|
||||||
_opts.prettify = opts.prettify === true;
|
_opts.prettify = opts.prettify === true;
|
||||||
_opts["private"] = opts["private"] === true;
|
_opts["private"] = opts["private"] === true;
|
||||||
|
_opts.noescape = opts.noescape === true;
|
||||||
_opts.css = opts.css;
|
_opts.css = opts.css;
|
||||||
_opts.pdf = opts.pdf;
|
_opts.pdf = opts.pdf;
|
||||||
_opts.wrap = opts.wrap || 60;
|
_opts.wrap = opts.wrap || 60;
|
||||||
|
@ -123,6 +123,7 @@ main = module.exports = ( rawArgs, exitCallback ) ->
|
|||||||
.option('--no-sort', 'Sort resume sections by date', false)
|
.option('--no-sort', 'Sort resume sections by date', false)
|
||||||
.option('--tips', 'Display theme tips and warnings.', false)
|
.option('--tips', 'Display theme tips and warnings.', false)
|
||||||
.option('--private', 'Include resume fields marked as private', 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')
|
.description('Generate resume to multiple formats')
|
||||||
.action(( sources, targets, options ) ->
|
.action(( sources, targets, options ) ->
|
||||||
x = splitSrcDest.call( this );
|
x = splitSrcDest.call( this );
|
||||||
@ -238,12 +239,14 @@ initOptions = ( ar ) ->
|
|||||||
isSilent = _.some args, (v) -> v == '-s' || v == '--silent'
|
isSilent = _.some args, (v) -> v == '-s' || v == '--silent'
|
||||||
isAssert = _.some args, (v) -> v == '-a' || v == '--assert'
|
isAssert = _.some args, (v) -> v == '-a' || v == '--assert'
|
||||||
isMono = _.some args, (v) -> v == '--no-color'
|
isMono = _.some args, (v) -> v == '--no-color'
|
||||||
|
isNoEscape = _.some args, (v) -> v == '--no-escape'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
color: !isMono,
|
color: !isMono,
|
||||||
debug: isDebug,
|
debug: isDebug,
|
||||||
silent: isSilent,
|
silent: isSilent,
|
||||||
assert: isAssert,
|
assert: isAssert,
|
||||||
|
noescape: isNoEscape,
|
||||||
orgVerb: oVerb,
|
orgVerb: oVerb,
|
||||||
verb: verb,
|
verb: verb,
|
||||||
json: oJSON,
|
json: oJSON,
|
||||||
|
@ -29,8 +29,8 @@ HandlebarsGenerator = module.exports =
|
|||||||
|
|
||||||
try
|
try
|
||||||
# Compile and run the Handlebars template.
|
# Compile and run the Handlebars template.
|
||||||
template = HANDLEBARS.compile tpl, {
|
template = HANDLEBARS.compile tpl,
|
||||||
strict: false, assumeObjects: false, noEscape: true}
|
strict: false, assumeObjects: false, noEscape: data.opts.noescape || false
|
||||||
return template data
|
return template data
|
||||||
catch
|
catch
|
||||||
throw
|
throw
|
||||||
|
@ -170,6 +170,7 @@ _prep = ( src, dst, opts ) ->
|
|||||||
_opts.theme = (opts.theme && opts.theme.toLowerCase().trim()) || 'modern';
|
_opts.theme = (opts.theme && opts.theme.toLowerCase().trim()) || 'modern';
|
||||||
_opts.prettify = opts.prettify is true
|
_opts.prettify = opts.prettify is true
|
||||||
_opts.private = opts.private is true
|
_opts.private = opts.private is true
|
||||||
|
_opts.noescape = opts.noescape is true
|
||||||
_opts.css = opts.css
|
_opts.css = opts.css
|
||||||
_opts.pdf = opts.pdf
|
_opts.pdf = opts.pdf
|
||||||
_opts.wrap = opts.wrap || 60
|
_opts.wrap = opts.wrap || 60
|
||||||
|
Loading…
Reference in New Issue
Block a user