mirror of
https://github.com/JuanCanham/jsonresume-theme-modern.git
synced 2024-10-31 23:56:22 +00:00
52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
var fs = require('fs');
|
|
var gravatar = require('gravatar');
|
|
var _ = require('lodash')
|
|
var Mustache = require('mustache');
|
|
|
|
function render(resumeObject) {
|
|
|
|
|
|
_.each(resumeObject.work, function(w){
|
|
w.startDateYear = w.startDate.substr(0,4);
|
|
if(w.endDate) {
|
|
w.endDateYear = w.endDate.substr(0,4);
|
|
} else {
|
|
w.endDateYear = 'Present'
|
|
}
|
|
});
|
|
_.each(resumeObject.education, function(e){
|
|
if( !e.area || !e.studyType ){
|
|
e.educationDetail = (e.area == null ? '' : e.area) + (e.studyType == null ? '' : e.studyType);
|
|
} else {
|
|
e.educationDetail = e.area + ", "+ e.studyType;
|
|
}
|
|
e.startDateYear = e.startDate.substr(0,4);
|
|
if(e.endDate) {
|
|
e.endDateYear = e.endDate.substr(0,4);
|
|
} else {
|
|
e.endDateYear = 'Present'
|
|
}
|
|
});
|
|
if(resumeObject.basics && resumeObject.basics.email) {
|
|
resumeObject.basics.gravatar = gravatar.url(resumeObject.basics.email, {
|
|
s: '100',
|
|
r: 'pg',
|
|
d: 'mm'
|
|
});
|
|
}
|
|
resumeObject.profiles = {};
|
|
|
|
_.each(resumeObject.basics.profiles, function(profile){
|
|
resumeObject.profiles[profile.network] = profile.username;
|
|
});
|
|
console.log(resumeObject.profiles);
|
|
var theme = fs.readFileSync(__dirname + '/resume.template', 'utf8');
|
|
var resumeHTML = Mustache.render(theme, resumeObject);
|
|
|
|
|
|
return resumeHTML;
|
|
};
|
|
module.exports = {
|
|
render: render
|
|
}
|