8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/temple/coffee_script/filters/attribute_merger.rb', line 8
def on_html_attrs(*attrs)
names = []
result = {}
attrs.each do |html, attr, name, value|
raise(InvalidExpression, 'Attribute is not a html attr') if html != :html || attr != :attr
name = name.to_s
if delimiter = options[:merge_attrs][name]
if current = result[name]
current << [:static, delimiter] << value
else
result[name] = [:multi, value]
names << name
end
else
raise "Multiple #{name} attributes specified" if result[name]
result[name] = value
names << name
end
end
[:html, :attrs, *names.map {|name| [:html, :attr, name, result[name]]}]
end
|