1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-04 13:27:07 +01:00

Add baseline Markdownification.

This commit is contained in:
devlinjd
2015-12-08 22:22:33 -05:00
parent e8704e1374
commit f3c9f92263
2 changed files with 39 additions and 13 deletions

View File

@ -18,25 +18,15 @@ Underscore template generate for FluentCV.
}
_.templateSettings = delims;
// Convert {{ someVar }} to {% print(filt.out(someVar) %}
// Convert {{ someVar|someFilter }} to {% print(filt.someFilter(someVar) %}
jst = jst.replace( delims.interpolate, function replace(m, p1) {
if( p1.indexOf('|') > -1 ) {
var terms = p1.split('|');
return '[~ print( filt.' + terms[1] + '( ' + terms[0] + ' )) ~]';
}
else {
return '[~ print( filt.out(' + p1 + ') ) ~]';
}
});
// Strip {# comments #}
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,
r: json.markdownify(),
filt: opts.filters,
cssInfo: cssInfo,
headFragment: opts.headFragment || ''