mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-12-23 05:37:23 +00:00
commit
7c0354046c
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hackmyresume",
|
||||
"version": "1.0.1",
|
||||
"version": "1.1.0",
|
||||
"description": "Generate polished résumés and CVs in HTML, Markdown, LaTeX, MS Word, PDF, plain text, JSON, XML, YAML, smoke signal, and carrier pigeon.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -13,19 +13,23 @@ Generic template helper definitions for FluentCV.
|
||||
, _ = require('underscore');
|
||||
|
||||
/**
|
||||
Register useful Handlebars helpers.
|
||||
@method registerHelpers
|
||||
Generic template helper function definitions.
|
||||
@class GenericHelpers
|
||||
*/
|
||||
module.exports = {
|
||||
var GenericHelpers = module.exports = {
|
||||
|
||||
// Set up a date formatting helper so we can do:
|
||||
// {{formatDate val 'YYYY-MM'}}
|
||||
/**
|
||||
Convert the input date to a specified format through Moment.js.
|
||||
@method formatDate
|
||||
*/
|
||||
formatDate: function(datetime, format) {
|
||||
return moment ? moment( datetime ).format( format ) : datetime;
|
||||
},
|
||||
|
||||
// Set up a Markdown-to-WordProcessingML helper so we can do:
|
||||
// {{wmpl val [true|false]}}
|
||||
/**
|
||||
Convert inline Markdown to inline WordProcessingML.
|
||||
@method wpml
|
||||
*/
|
||||
wpml: function( txt, inline ) {
|
||||
if(!txt) return '';
|
||||
inline = (inline && !inline.hash) || false;
|
||||
@ -36,24 +40,31 @@ Generic template helper definitions for FluentCV.
|
||||
return txt;
|
||||
},
|
||||
|
||||
// Set up a last-word helper so we can do:
|
||||
// {{lastWord val [true|false]}}
|
||||
/**
|
||||
Emit a conditional link.
|
||||
@method link
|
||||
*/
|
||||
link: function( text, url ) {
|
||||
return url && url.trim() ?
|
||||
('<a href="' + url + '">' + text + '</a>') : text;
|
||||
},
|
||||
|
||||
// Set up a last-word helper so we can do:
|
||||
// {{lastWord val [true|false]}}
|
||||
/**
|
||||
Return the last word of the specified text.
|
||||
@method lastWord
|
||||
*/
|
||||
lastWord: function( txt ) {
|
||||
return txt && txt.trim() ? _.last( txt.split(' ') ) : '';
|
||||
},
|
||||
|
||||
// Set up a skill colorizing helper:
|
||||
// {{skillColor val}}
|
||||
// Skill level can be expressed as a string ("beginner", "intermediate",
|
||||
// etc.), as an integer (1,5,etc), as a string integer ("1", "5", etc.),
|
||||
// or as an RRGGBB color triplet ('#C00000', '#FFFFAA').
|
||||
/**
|
||||
Convert a skill level to an RGB color triplet.
|
||||
@method skillColor
|
||||
@param lvl Input skill level. Skill level can be expressed as a string
|
||||
("beginner", "intermediate", etc.), as an integer (1,5,etc), as a string
|
||||
integer ("1", "5", etc.), or as an RRGGBB color triplet ('#C00000',
|
||||
'#FFFFAA').
|
||||
*/
|
||||
skillColor: function( lvl ) {
|
||||
var idx = skillLevelToIndex( lvl );
|
||||
var skillColors = (this.theme && this.theme.palette &&
|
||||
@ -62,40 +73,52 @@ Generic template helper definitions for FluentCV.
|
||||
return skillColors[idx];
|
||||
},
|
||||
|
||||
// Set up a skill colorizing helper:
|
||||
// {{skillColor val}}
|
||||
/**
|
||||
Return an appropriate height.
|
||||
@method lastWord
|
||||
*/
|
||||
skillHeight: function( lvl ) {
|
||||
var idx = skillLevelToIndex( lvl );
|
||||
return ['38.25', '30', '16', '8', '0'][idx];
|
||||
},
|
||||
|
||||
// Set up a Markdown-to-WordProcessingML helper so we can do:
|
||||
// {{initialWords val [true|false]}}
|
||||
/**
|
||||
Return all but the last word of the input text.
|
||||
@method initialWords
|
||||
*/
|
||||
initialWords: function( txt ) {
|
||||
return txt && txt.trim() ? _.initial( txt.split(' ') ).join(' ') : '';
|
||||
},
|
||||
|
||||
// Set up a URL-trimming helper to drop the protocol so we can do:
|
||||
// {{trimURL url}}
|
||||
/**
|
||||
Trim the protocol (http or https) from a URL/
|
||||
@method trimURL
|
||||
*/
|
||||
trimURL: function( url ) {
|
||||
return url && url.trim() ? url.trim().replace(/^https?:\/\//i, '') : '';
|
||||
},
|
||||
|
||||
// Set up a URL-trimming helper to drop the protocol so we can do:
|
||||
// {{trimURL url}}
|
||||
/**
|
||||
Convert text to lowercase.
|
||||
@method toLower
|
||||
*/
|
||||
toLower: function( txt ) {
|
||||
return txt && txt.trim() ? txt.toLowerCase() : '';
|
||||
},
|
||||
|
||||
// Set up a Markdown-to-WordProcessingML helper so we can do:
|
||||
// {{either A B}}
|
||||
/**
|
||||
Return true if either value is truthy.
|
||||
@method either
|
||||
*/
|
||||
either: function( lhs, rhs, options ) {
|
||||
if (lhs || rhs) return options.fn(this);
|
||||
},
|
||||
|
||||
// Set up a generic conditional helper so we can do:
|
||||
// {{compare val otherVal operator="<"}}
|
||||
// http://doginthehat.com.au/2012/02/comparison-block-helper-for-handlebars-templates/
|
||||
/**
|
||||
Perform a generic comparison.
|
||||
See: http://doginthehat.com.au/2012/02/comparison-block-helper-for-handlebars-templates
|
||||
@method compare
|
||||
*/
|
||||
compare: function(lvalue, rvalue, options) {
|
||||
if (arguments.length < 3)
|
||||
throw new Error("Handlerbars Helper 'compare' needs 2 parameters");
|
||||
|
@ -47,7 +47,6 @@ function main() {
|
||||
opts = getOpts( a );
|
||||
logMsg( title );
|
||||
|
||||
|
||||
// Get the action to be performed
|
||||
var params = a._.map( function(p){ return p.toLowerCase().trim(); });
|
||||
var verb = params[0];
|
||||
@ -56,7 +55,7 @@ function main() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get source and dest params
|
||||
// Find the TO keyword, if any
|
||||
var splitAt = _.indexOf( params, 'to' );
|
||||
if( splitAt === a._.length - 1 ) {
|
||||
// 'TO' cannot be the last argument
|
||||
@ -66,8 +65,10 @@ function main() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Massage inputs and outputs
|
||||
var src = a._.slice(1, splitAt === -1 ? undefined : splitAt );
|
||||
var dst = splitAt === -1 ? [] : a._.slice( splitAt + 1 );
|
||||
( splitAt === -1 ) && dst.push( src.pop() ); // Allow omitting TO keyword
|
||||
var parms = [ src, dst, opts, logMsg ];
|
||||
|
||||
// Invoke the action
|
||||
|
@ -17,3 +17,7 @@ String.isNullOrWhitespace = function( input ) {
|
||||
String.prototype.endsWith = function(suffix) {
|
||||
return this.indexOf(suffix, this.length - suffix.length) !== -1;
|
||||
};
|
||||
|
||||
String.is = function( val ) {
|
||||
return typeof val === 'string' || val instanceof String;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user