Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Rob Sayre sayrer authored

Showing 2 changed files with 15 additions and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  lib/compiler.js
  2. +14 0 test/index.js
2  lib/compiler.js
@@ -135,7 +135,7 @@
135 135 } else {
136 136 if (tagChange(ctag, text, i)) {
137 137 tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
138   - i: (tagType == '/') ? seenTag - ctag.length : i + otag.length});
  138 + i: (tagType == '/') ? seenTag - otag.length : i + ctag.length});
139 139 buf = '';
140 140 i += ctag.length - 1;
141 141 state = IN_TEXT;
14 test/index.js
@@ -1066,3 +1066,17 @@ test("Default Render Impl", function() {
1066 1066 var ht = new Hogan.Template();
1067 1067 is(ht.render() === '', true, 'default renderImpl returns an array.');
1068 1068 });
  1069 +
  1070 +test("Section With Custom Uneven Delimiter Length", function() {
  1071 + var text = '{{=<% %%>=}}Test<%#foo%%>bar<%/foo%%>';
  1072 + var t = Hogan.compile(text);
  1073 + var context = {
  1074 + foo: function() {
  1075 + return function(s) {
  1076 + return "<b>" + s + "</b>";
  1077 + }
  1078 + }
  1079 + }
  1080 + var s = t.render(context);
  1081 + is(s, 'Test<b>bar</b>', 'Section content is correct with uneven reset delimiter length');
  1082 +});

0 comments on commit 7a7e38c

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