Skip to content
Browse files

Fix delimiters with extra whitespace in between tokens.

  • Loading branch information...
1 parent 1fa2f50 commit 0d625bf038c33f97507eaca010179eedc81671b4 @sayrer sayrer committed
Showing with 8 additions and 1 deletion.
  1. +1 −1 lib/compiler.js
  2. +7 −0 test/index.js
View
2 lib/compiler.js
@@ -94,7 +94,7 @@
).split(' ');
otag = delimiters[0];
- ctag = delimiters[1];
+ ctag = delimiters[delimiters.length - 1];
return closeIndex + close.length - 1;
}
View
7 test/index.js
@@ -177,6 +177,13 @@ test("Set Delimiter With Whitespace", function() {
is(s, 'bar', "custom delimiters with whitespace works.")
});
+test("Delimiters with extra whitespace", function() {
+ var text = "{{= | | =}}|foo|";
+ var t = Hogan.compile(text);
+ var s = t.render({foo: "bar"});
+ is(s, 'bar', "custom delimiters with extra whitespace works");
+});
+
test("Delimiter cache busting", function() {
var text = "|foo|[foo]";
var t = Hogan.compile(text, {delimiters: "| |"});

0 comments on commit 0d625bf

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