Skip to content
This repository
Browse code

Merge pull request #92 from Sannis/dot-1.x-support

Re-add doT - global leaks fixed
  • Loading branch information...
commit 579da6bf6aec403af9d3a3ca8cd8890690fbe37e 2 parents 2511724 + 7bf3050
TJ Holowaychuk authored February 23, 2013
22  lib/consolidate.js
@@ -673,4 +673,24 @@ exports.toffee.render = function(str, options, fn) {
673 673
   } catch (err) {
674 674
     fn(err);
675 675
   }
676  
-}
  676
+};
  677
+
  678
+/**
  679
+ * doT support.
  680
+ */
  681
+
  682
+exports.dot = fromStringRenderer('dot');
  683
+
  684
+/**
  685
+ * doT string support.
  686
+ */
  687
+
  688
+exports.dot.render = function (str, options, fn) {
  689
+  var engine = requires.dot || (requires.dot = require('dot'));
  690
+  try {
  691
+    var tmpl = cache(options) || cache(options, engine.compile(str));
  692
+    fn(null, tmpl(options));
  693
+  } catch (err) {
  694
+    fn(err);
  695
+  }
  696
+};
5  package.json
@@ -33,8 +33,9 @@
33 33
     "ect": "0.2.10",
34 34
     "mote": "0.2.0",
35 35
     "toffee": "0.0.52",
36  
-	  "atpl": ">=0.5.5",
37  
-    "templayed": ">=0.2.3"
  36
+    "atpl": ">=0.5.5",
  37
+    "templayed": ">=0.2.3",
  38
+    "dot": "1.0.1"
38 39
   },
39 40
   "main": "index",
40 41
   "scripts": {
3  test/consolidate.js
@@ -25,4 +25,5 @@ require('./shared').test('ect');
25 25
 require('./shared').test('mote');
26 26
 require('./shared').test('toffee');
27 27
 require('./shared').test('atpl');
28  
-require('./shared').test('templayed');
  28
+require('./shared').test('templayed');
  29
+require('./shared').test('dot');
1  test/fixtures/dot/user.dot
... ...
@@ -0,0 +1 @@
  1
+<p>{{=it.user.name}}</p>

0 notes on commit 579da6b

Please sign in to comment.
Something went wrong with that request. Please try again.