diff --git a/lib/hamlit/compiler/attribute_compiler.rb b/lib/hamlit/compiler/attribute_compiler.rb index aaf200f0..403a6882 100644 --- a/lib/hamlit/compiler/attribute_compiler.rb +++ b/lib/hamlit/compiler/attribute_compiler.rb @@ -128,11 +128,16 @@ module Hamlit end def compile_common!(temple, key, static_value, dynamic_values) - value = build_attr(:static, key, static_value) if static_value + type, value = :static, static_value if static_value dynamic_values.each do |dynamic_value| - value = build_attr(:dynamic, key, dynamic_value) + type, value = :dynamic, dynamic_value end - temple << value + + if type == :dynamic && StaticAnalyzer.static?(value) + type, value = :static, eval("(#{value}).to_s") + end + + temple << build_attr(type, key, value) end def build_attr(type, key, value)