Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Do not require a space between a variable name and closing bracket, e…

….g. allow "{{var1}}"

git-svn-id: http://erlydtl.googlecode.com/svn/trunk@153 a5195066-8e3e-0410-a82a-05b01b1b9875
  • Loading branch information...
commit b6fc05395a7de611d863353d5d2985aadcda890a 1 parent 292951c
emmiller authored
View
8 src/erlydtl/erlydtl_scanner.erl
@@ -172,18 +172,18 @@ scan("." ++ T, Scanned, {Row, Column}, {_, Closer}) ->
scan(" " ++ T, Scanned, {Row, Column}, {_, Closer}) ->
scan(T, Scanned, {Row, Column + 1}, {in_code, Closer});
-scan("}}-->" ++ T, Scanned, {Row, Column}, {in_code, "}}-->"}) ->
+scan("}}-->" ++ T, Scanned, {Row, Column}, {_, "}}-->"}) ->
scan(T, [{close_var, {Row, Column}, lists:reverse("}}-->")} | Scanned],
{Row, Column + 2}, in_text);
-scan("}}" ++ T, Scanned, {Row, Column}, {in_code, "}}"}) ->
+scan("}}" ++ T, Scanned, {Row, Column}, {_, "}}"}) ->
scan(T, [{close_var, {Row, Column}, "}}"} | Scanned], {Row, Column + 2}, in_text);
-scan("%}-->" ++ T, Scanned, {Row, Column}, {in_code, "%}-->"}) ->
+scan("%}-->" ++ T, Scanned, {Row, Column}, {_, "%}-->"}) ->
scan(T, [{close_tag, {Row, Column}, lists:reverse("%}-->")} | Scanned],
{Row, Column + 2}, in_text);
-scan("%}" ++ T, Scanned, {Row, Column}, {in_code, "%}"}) ->
+scan("%}" ++ T, Scanned, {Row, Column}, {_, "%}"}) ->
scan(T, [{close_tag, {Row, Column}, lists:reverse("%}")} | Scanned],
{Row, Column + 2}, in_text);
View
5 src/tests/erlydtl_unittests.erl
@@ -13,7 +13,10 @@ tests() ->
[{var1, 42}], <<"The magic number is: 42">>},
{"float",
<<"The price of milk is: {{ var1 }}">>,
- [{var1, 0.42}], <<"The price of milk is: 0.42">>}
+ [{var1, 0.42}], <<"The price of milk is: 0.42">>},
+ {"No spaces",
+ <<"{{var1}}">>,
+ [{var1, "foo"}], <<"foo">>}
]},
{"comment", [
{"comment block is excised",
Please sign in to comment.
Something went wrong with that request. Please try again.