1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-22 16:30:11 +00:00

Add support for user-definable section titles.

Introduce a {{sectionTitle}} helper; requires theme updates.
This commit is contained in:
hacksalot 2016-01-04 16:20:48 -05:00
parent 0f83f8f5c2
commit 2ba23ee80d
2 changed files with 37 additions and 2 deletions

View File

@ -28,6 +28,40 @@ Generic template helper definitions for HackMyResume / FluentCV.
return moment ? moment( datetime ).format( format ) : datetime;
},
/**
Generic template helper function to display a user-overridable section
title for a FRESH resume theme. Use this in lieue of hard-coding section
titles.
Usage:
{{sectionTitle "sectionName"}}
{{sectionTitle "sectionName" "sectionTitle"}}
Example:
{{sectionTitle "Education"}}
{{sectionTitle "Employment" "Project History"}}
@param sect_name The name of the section being title. Must be one of the
top-level FRESH resume sections ("info", "education", "employment", etc.).
@param sect_title The theme-specified section title. May be replaced by the
user.
@method sectionTitle
*/
sectionTitle: function( sname, stitle ) {
// If not provided by the user, stitle should default to sname. ps.
// Handlebars silently passes in the options object to the last param,
// where in Underscore stitle will be null/undefined, so we check both.
stitle = (stitle && String.is(stitle)) || sname;
// If there's a section title override, use it.
return ( this.opts.stitles &&
this.opts.stitles[ sname.toLowerCase().trim() ] ) ||
stitle;
},
/**
Convert inline Markdown to inline WordProcessingML.
@method wpml
@ -61,7 +95,7 @@ Generic template helper definitions for HackMyResume / FluentCV.
},
/**
Convert a skill level to an RGB color triplet.
Convert a skill level to an RGB color triplet. TODO: refactor
@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
@ -77,7 +111,7 @@ Generic template helper definitions for HackMyResume / FluentCV.
},
/**
Return an appropriate height.
Return an appropriate height. TODO: refactor
@method lastWord
*/
skillHeight: function( lvl ) {

View File

@ -55,6 +55,7 @@ Implementation of the 'generate' verb for HackMyResume.
_opts.css = opts.css || 'embed';
_opts.pdf = opts.pdf;
_opts.wrap = opts.wrap || 60;
_opts.stitles = opts.sectionTitles;
// If two or more files are passed to the GENERATE command and the TO
// keyword is omitted, the last file specifies the output file.