jsonresume-theme-modern/index.js

42 lines
1.0 KiB
JavaScript
Raw Normal View History

2014-07-08 08:45:52 +01:00
var fs = require('fs');
var gravatar = require('gravatar');
2014-07-08 08:50:56 +01:00
var _ = require('lodash')
2014-07-08 08:49:24 +01:00
var Mustache = require('mustache');
2014-07-08 08:24:23 +01:00
function render(resumeObject) {
2014-07-08 08:45:52 +01:00
_.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'
});
}
2014-07-08 08:48:16 +01:00
var theme = fs.readFileSync(__dirname + '/resume.template', 'utf8');
2014-07-08 08:45:52 +01:00
var resumeHTML = Mustache.render(theme, resumeObject);
2014-07-08 08:52:15 +01:00
return resumeHTML;
2014-07-08 05:44:13 +01:00
};
module.exports = {
2014-07-08 08:24:23 +01:00
render: render
}