Hookup escape tags
diff --git a/lib/template.dart b/lib/template.dart
index fef9907..e32856b 100644
--- a/lib/template.dart
+++ b/lib/template.dart
@@ -11,8 +11,8 @@
_Node _parseTokens(List<_Token> tokens, bool lenient) {
var stack = new List<_Node>()..add(new _Node(_OPEN_SECTION, 'root', 0, 0));
for (var t in tokens) {
- if (t.type == _TEXT || t.type == _VARIABLE) {
- if (t.type == _VARIABLE)
+ if (t.type == _TEXT || t.type == _VARIABLE || t.type == _UNESC_VARIABLE) {
+ if (t.type == _VARIABLE || t.type == _UNESC_VARIABLE)
_checkTagChars(t, lenient);
stack.last.children.add(new _Node.fromToken(t));
diff --git a/test/mustache_test.dart b/test/mustache_test.dart
index 35aa38f..7ee74f9 100644
--- a/test/mustache_test.dart
+++ b/test/mustache_test.dart
@@ -238,13 +238,15 @@
});
group('Escape tags', () {
- test('Unimplemented {{{ ... }}}', () {
- var fn = () => parse('{{{ blah }}}').renderString({});
- expect(fn, throwsUnimplementedError);
+ test('{{{ ... }}}', () {
+ var output = parse('{{{blah}}}')
+ .renderString({'blah': '&'});
+ expect(output, equals('&'));
});
- test('Unimplemented {{& ... }}', () {
- var fn = () => parse('{{& blah }}').renderString({});
- expect(fn, throwsUnimplementedError);
+ test('{{& ... }}', () {
+ var output = parse('{{{blah}}}')
+ .renderString({'blah': '&'});
+ expect(output, equals('&'));
});
});