Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #72 from plecong/master

Fix Scanner Indexes of Section With Uneven Reset Delimiters
  • Loading branch information...
commit 7a7e38cab37d9a94a3d18d03a7f638ae8394ab37 2 parents 4a5135d + c93da06
@sayrer sayrer authored
Showing with 15 additions and 1 deletion.
  1. +1 −1  lib/compiler.js
  2. +14 −0 test/index.js
View
2  lib/compiler.js
@@ -135,7 +135,7 @@
} else {
if (tagChange(ctag, text, i)) {
tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
- i: (tagType == '/') ? seenTag - ctag.length : i + otag.length});
+ i: (tagType == '/') ? seenTag - otag.length : i + ctag.length});
buf = '';
i += ctag.length - 1;
state = IN_TEXT;
View
14 test/index.js
@@ -1066,3 +1066,17 @@ test("Default Render Impl", function() {
var ht = new Hogan.Template();
is(ht.render() === '', true, 'default renderImpl returns an array.');
});
+
+test("Section With Custom Uneven Delimiter Length", function() {
+ var text = '{{=<% %%>=}}Test<%#foo%%>bar<%/foo%%>';
+ var t = Hogan.compile(text);
+ var context = {
+ foo: function() {
+ return function(s) {
+ return "<b>" + s + "</b>";
+ }
+ }
+ }
+ var s = t.render(context);
+ is(s, 'Test<b>bar</b>', 'Section content is correct with uneven reset delimiter length');
+});
Please sign in to comment.
Something went wrong with that request. Please try again.