mirror of
https://github.com/JuanCanham/jsonresume-theme-modern.git
synced 2024-11-25 01:30:16 +00:00
41 lines
1012 B
JavaScript
41 lines
1012 B
JavaScript
var fs = require('fs');
|
|
var gravatar = require('gravatar');
|
|
var _ = require('lodash');
|
|
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){
|
|
e.startDateYear = e.startDate.substr(0,4);
|
|
if(e.endDate) {
|
|
e.endDateYear = e.endDate.substr(0,4);
|
|
} else {
|
|
e.endDateYear = 'Present'
|
|
}
|
|
});
|
|
if(resumeObject.bio && resumeObject.bio.email && resumeObject.bio.email.personal) {
|
|
resumeObject.bio.gravatar = gravatar.url(resumeObject.bio.email.personal, {
|
|
s: '100',
|
|
r: 'pg',
|
|
d: 'mm'
|
|
});
|
|
}
|
|
|
|
var theme = fs.readFileSync(__dirname + 'resume.template', 'utf8');
|
|
var resumeHTML = Mustache.render(theme, resumeObject);
|
|
|
|
|
|
return JSON.stringify(resumeHTML);
|
|
};
|
|
|
|
module.exports = {
|
|
render: render
|
|
}
|