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