mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Compile static common attributes statically
This commit is contained in:
parent
2c23f95fbe
commit
ec2aecb4bd
1 changed files with 8 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue