mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 08:20:11 +00:00
Introduce {{fontFace}} helper.
This commit is contained in:
parent
c9825fa016
commit
a935fe7dc2
@ -20,10 +20,7 @@ Generic template helper definitions for HackMyResume / FluentCV.
|
|||||||
, _ = require('underscore')
|
, _ = require('underscore')
|
||||||
, unused = require('../utils/string');
|
, unused = require('../utils/string');
|
||||||
|
|
||||||
/**
|
/** Generic template helper function definitions. */
|
||||||
Generic template helper function definitions.
|
|
||||||
@class GenericHelpers
|
|
||||||
*/
|
|
||||||
var GenericHelpers = module.exports = {
|
var GenericHelpers = module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,9 +74,30 @@ Generic template helper definitions for HackMyResume / FluentCV.
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
fontFace: function( styleName ) {
|
/**
|
||||||
|
Emit the font face (such as 'Helvetica' or 'Calibri') associated with the
|
||||||
|
provided key.
|
||||||
|
@param key {String} A named style from the "fonts" section of the theme's
|
||||||
|
theme.json file. For example: 'default' or 'heading1'.
|
||||||
|
*/
|
||||||
|
fontFace: function( key ) {
|
||||||
|
if( key && key.trim() && GenericHelpers.theme.fonts ) {
|
||||||
|
var fontSpec = GenericHelpers.theme.fonts[ key ];
|
||||||
|
if( fontSpec )
|
||||||
|
return String.is( fontSpec ) ? fontSpec : fontSpec[0];
|
||||||
|
}
|
||||||
|
_reportError( HMSTATUS.invalidHelperUse, { helper: 'fontFace' } );
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
Emit a comma-delimited list of font names suitable associated with the
|
||||||
|
provided key.
|
||||||
|
@param styleName
|
||||||
|
*/
|
||||||
|
fontList: function( key ) {
|
||||||
var ret = '';
|
var ret = '';
|
||||||
var fontSpec = GenericHelpers.theme.fonts[ styleName ];
|
var fontSpec = GenericHelpers.theme.fonts[ key ];
|
||||||
if( _.isArray( fontSpec ) ) {
|
if( _.isArray( fontSpec ) ) {
|
||||||
fontSpec = fontSpec.map( function(ff) {
|
fontSpec = fontSpec.map( function(ff) {
|
||||||
return "'" + ff + "'";
|
return "'" + ff + "'";
|
||||||
|
Loading…
Reference in New Issue
Block a user