mirror of
				https://github.com/JuanCanham/HackMyResume.git
				synced 2025-10-31 13:17:26 +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:
		| @@ -11,7 +11,6 @@ Definition of the UnderscoreGenerator class. | |||||||
|   var _ = require('underscore'); |   var _ = require('underscore'); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|   Perform template-based resume generation using Underscore.js. |   Perform template-based resume generation using Underscore.js. | ||||||
|   @class UnderscoreGenerator |   @class UnderscoreGenerator | ||||||
| @@ -32,6 +31,10 @@ Definition of the UnderscoreGenerator class. | |||||||
|       // Strip {# comments #} |       // Strip {# comments #} | ||||||
|       jst = jst.replace( delims.comment, ''); |       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. |       // Compile and run the template. TODO: avoid unnecessary recompiles. | ||||||
|       var compiled = _.template(jst); |       var compiled = _.template(jst); | ||||||
|       var ret = compiled({ |       var ret = compiled({ | ||||||
| @@ -40,13 +43,15 @@ Definition of the UnderscoreGenerator class. | |||||||
|         XML: require('xml-escape'), |         XML: require('xml-escape'), | ||||||
|         RAW: json, |         RAW: json, | ||||||
|         cssInfo: cssInfo, |         cssInfo: cssInfo, | ||||||
|         headFragment: opts.headFragment || '' |         headFragment: opts.headFragment || '', | ||||||
|  |         opts: opts, | ||||||
|  |         h: helpers | ||||||
|       }); |       }); | ||||||
|       return ret; |       return ret; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|    |  | ||||||
|  |  | ||||||
| }()); | }()); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user