Просмотр исходного кода

Interpret variable names in custom tags correctly. Thanks to davebcn.

Evan Miller 15 лет назад
Родитель
Сommit
a078c36ae5
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      src/erlydtl/erlydtl_compiler.erl

+ 2 - 1
src/erlydtl/erlydtl_compiler.erl

@@ -706,7 +706,8 @@ tag_ast(Name, Args, Context, TreeWalker) ->
                     ({{identifier, _, Key}, {string_literal, _, Value}}) ->
                     ({{identifier, _, Key}, {string_literal, _, Value}}) ->
                         {list_to_atom(Key), erl_syntax:string(unescape_string_literal(Value))};
                         {list_to_atom(Key), erl_syntax:string(unescape_string_literal(Value))};
                     ({{identifier, _, Key}, Value}) ->
                     ({{identifier, _, Key}, Value}) ->
-                        {list_to_atom(Key), format(resolve_variable_ast(Value, Context), Context)}
+                        {AST, _} = resolve_variable_ast(Value, Context),
+                        {list_to_atom(Key), format(AST,Context)}
                 end, Args),
                 end, Args),
             DefaultFilePath = filename:join([erlydtl_deps:get_base_dir(), "priv", "custom_tags", Name]),
             DefaultFilePath = filename:join([erlydtl_deps:get_base_dir(), "priv", "custom_tags", Name]),
             case Context#dtl_context.custom_tags_dir of
             case Context#dtl_context.custom_tags_dir of