1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-22 16:30:11 +00:00

Expose helpers to Underscore engine.

Get the same set of helpers working for Underscore and Handlebars
engines. Needs refactoring.
This commit is contained in:
hacksalot 2015-12-30 20:11:09 -05:00
parent 76cafa4249
commit 3acf648eb4

View File

@ -11,7 +11,6 @@ Definition of the UnderscoreGenerator class.
var _ = require('underscore');
/**
Perform template-based resume generation using Underscore.js.
@class UnderscoreGenerator
@ -32,6 +31,10 @@ Definition of the UnderscoreGenerator class.
// Strip {# comments #}
jst = jst.replace( delims.comment, '');
var helpers = require('./generic-helpers');
helpers.opts = opts;
helpers.cssInfo = cssInfo;
// Compile and run the template. TODO: avoid unnecessary recompiles.
var compiled = _.template(jst);
var ret = compiled({
@ -40,13 +43,15 @@ Definition of the UnderscoreGenerator class.
XML: require('xml-escape'),
RAW: json,
cssInfo: cssInfo,
headFragment: opts.headFragment || ''
headFragment: opts.headFragment || '',
opts: opts,
h: helpers
});
return ret;
}
};
}());