orb_template 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/orb/temple/attributes_compiler.rb +15 -6
- data/lib/orb/temple/filters.rb +15 -8
- data/lib/orb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f1c41f096022c85642d784cf67913242d442b713ea80a785d7376fd46e0adda9
|
|
4
|
+
data.tar.gz: a33ad24ce2430324227c420f96621567a1dd8c26edd7af19756cc46d7c154fbd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1545224be64f1acd55ab9b027831197828cca8bf39e9c5de03b0b50b5fd80ebc85595a27519ec365ac206b7413cba293455f0335735fe20c1ef35c4b1db4deda
|
|
7
|
+
data.tar.gz: c8021731696a98c2737dc8e62903b5fefefb1f6b837109165a02500ae0a42cfa0a675849837fe2ebdfe43defee1b543510b0489aa38eb7a52438e44a2548f7c2
|
|
@@ -37,15 +37,24 @@ module ORB
|
|
|
37
37
|
# compiled captures are available in the same scope.
|
|
38
38
|
def compile_komponent_args(attributes, prefix)
|
|
39
39
|
args = {}
|
|
40
|
-
|
|
41
|
-
# TODO: handle splat attributes
|
|
42
|
-
next if attribute.splat?
|
|
40
|
+
splats = []
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
attributes.each do |attribute|
|
|
43
|
+
if attribute.splat?
|
|
44
|
+
# Splat attribute values already include the ** prefix
|
|
45
|
+
splats << attribute.value
|
|
46
|
+
else
|
|
47
|
+
var_name = prefixed_variable_name(attribute.name, prefix)
|
|
48
|
+
args = args.deep_merge(dash_to_hash(attribute.name, var_name))
|
|
49
|
+
end
|
|
46
50
|
end
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
# Build the argument list
|
|
53
|
+
result_parts = []
|
|
54
|
+
result_parts << hash_to_args_list(args) unless args.empty?
|
|
55
|
+
result_parts += splats
|
|
56
|
+
|
|
57
|
+
result_parts.join(', ')
|
|
49
58
|
end
|
|
50
59
|
|
|
51
60
|
# Compile the attributes of a node into a Temple core abstraction
|
data/lib/orb/temple/filters.rb
CHANGED
|
@@ -118,14 +118,21 @@ module ORB
|
|
|
118
118
|
# Handle a dynamic node expression `[:orb, :dynamic, node, content]`
|
|
119
119
|
#
|
|
120
120
|
def on_orb_dynamic(node, content)
|
|
121
|
-
#
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
121
|
+
# Determine whether the node is an html_tag, component, or slot node
|
|
122
|
+
if node.component_tag?
|
|
123
|
+
on_orb_component(node, content)
|
|
124
|
+
elsif node.component_slot_tag?
|
|
125
|
+
on_orb_slot(node, content)
|
|
126
|
+
else
|
|
127
|
+
# It's a dynamic HTML tag
|
|
128
|
+
tmp = unique_name
|
|
129
|
+
splats = @attributes_compiler.compile_splat_attributes(node.splat_attributes)
|
|
130
|
+
code = "content_tag('#{node.tag}', #{splats}) do"
|
|
131
|
+
|
|
132
|
+
[:multi,
|
|
133
|
+
[:block, "#{tmp} = #{code}", compile(content)],
|
|
134
|
+
[:escape, true, [:dynamic, tmp]]]
|
|
135
|
+
end
|
|
129
136
|
end
|
|
130
137
|
end
|
|
131
138
|
end
|
data/lib/orb/version.rb
CHANGED