mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-12-23 13:47:22 +00:00
More MEGADESK.
This commit is contained in:
parent
f3c9f92263
commit
857de65750
@ -57,6 +57,12 @@ Definition of the FRESHResume class.
|
||||
return this;
|
||||
}
|
||||
|
||||
FreshResume.prototype.dupe = function() {
|
||||
var rnew = new FreshResume();
|
||||
rnew.parse( this.stringify(), { } );
|
||||
return rnew;
|
||||
};
|
||||
|
||||
/**
|
||||
Convert the supplied object to a JSON string, sanitizing meta-properties along
|
||||
the way.
|
||||
@ -77,30 +83,42 @@ Definition of the FRESHResume class.
|
||||
FreshResume.prototype.markdownify = function() {
|
||||
|
||||
var that = this;
|
||||
var ret = extend(true, { }, this);
|
||||
var ret = this.dupe();
|
||||
|
||||
function MDIN(txt){
|
||||
return MD(txt || '' ).replace(/^\s*\<p\>|\<\/p\>\s*$/gi, '');
|
||||
}
|
||||
|
||||
// TODO: refactor recursion
|
||||
function markdownifyStringsInObject( obj ) {
|
||||
function markdownifyStringsInObject( obj, inline ) {
|
||||
|
||||
if( !obj ) return;
|
||||
|
||||
inline = inline === undefined || inline;
|
||||
|
||||
if( Object.prototype.toString.call( obj ) === '[object Array]' ) {
|
||||
obj.forEach(function(elem){
|
||||
markdownifyStringsInObject( elem );
|
||||
obj.forEach(function(elem, idx, ar){
|
||||
if( typeof elem === 'string' || elem instanceof String )
|
||||
ar[idx] = inline ? MDIN(elem) : MD( elem );
|
||||
else
|
||||
markdownifyStringsInObject( elem );
|
||||
});
|
||||
}
|
||||
else if (typeof obj === 'object') {
|
||||
if( obj._isAMomentObject || obj.safe )
|
||||
return;
|
||||
Object.keys( obj ).forEach(function(key) {
|
||||
var sub = obj[key];
|
||||
if( typeof sub === 'string' || sub instanceof String )
|
||||
obj[key] = MD( obj[key] );
|
||||
if( typeof sub === 'string' || sub instanceof String ) {
|
||||
if( key !== 'url' )
|
||||
obj[key] = inline ? MDIN( obj[key] ) : MD( obj[key] );
|
||||
}
|
||||
else
|
||||
markdownifyStringsInObject( sub );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Object.keys( ret ).forEach(function(member){
|
||||
markdownifyStringsInObject( that[ member ] );
|
||||
markdownifyStringsInObject( ret[ member ] );
|
||||
});
|
||||
|
||||
return ret;
|
||||
@ -191,7 +209,8 @@ Definition of the FRESHResume class.
|
||||
Get the default (empty) sheet.
|
||||
*/
|
||||
FreshResume.default = function() {
|
||||
return new FreshResume().open( PATH.join( __dirname, 'empty-fresh.json'), 'Empty' );
|
||||
return new FreshResume().open(
|
||||
PATH.join( __dirname, 'empty-fresh.json'), 'Empty' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,10 +136,11 @@ Abstract theme representation.
|
||||
// Now, get all the CSS files...
|
||||
(this.cssFiles = fmts.filter(function( fmt ){ return fmt.ext === 'css'; }))
|
||||
.forEach(function( cssf ) {
|
||||
// For each CSS file, get its corresponding HTML file
|
||||
var idx = _.findIndex(fmts, function( fmt ) {
|
||||
return fmt.pre === cssf.pre && fmt.ext === 'html'
|
||||
// For each CSS file, get its corresponding HTML file
|
||||
var idx = _.findIndex(fmts, function( fmt ) {
|
||||
return fmt.pre === cssf.pre && fmt.ext === 'html'
|
||||
});
|
||||
cssf.action = null;
|
||||
fmts[ idx ].css = cssf.data;
|
||||
fmts[ idx ].cssPath = cssf.path;
|
||||
});
|
||||
|
@ -22,12 +22,11 @@ Underscore template generate for FluentCV.
|
||||
jst = jst.replace( delims.comment, '');
|
||||
// Compile and run the template. TODO: avoid unnecessary recompiles.
|
||||
var compiled = _.template(jst);
|
||||
|
||||
var mr = json.markdownify();
|
||||
|
||||
var ret = compiled({
|
||||
r: json.markdownify(),
|
||||
filt: opts.filters,
|
||||
XML: require('xml-escape'),
|
||||
RAW: json,
|
||||
cssInfo: cssInfo,
|
||||
headFragment: opts.headFragment || ''
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user