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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72cfaec138706b6a2a92cec82fc558a6dfe13a56e21dbad5fa18fd5234104a08
4
- data.tar.gz: 8fc11d77077c47693176181594c1ade6e39de19300ad66acfddbe9383bc8da3f
3
+ metadata.gz: f1c41f096022c85642d784cf67913242d442b713ea80a785d7376fd46e0adda9
4
+ data.tar.gz: a33ad24ce2430324227c420f96621567a1dd8c26edd7af19756cc46d7c154fbd
5
5
  SHA512:
6
- metadata.gz: 3cd200ecc1e3292f31fa5d90120a97850b5e6494bc157ba77cad66ea77662be835723fb2fe6a1bc7056052ee120c8e73bde4abf62177e36acebc6d11e5eebbd2
7
- data.tar.gz: eb9a1b1edb4e41cbbfeac8ff9f2230fb05ad1c9ea932c0a4bd2cdddb16697508394758a1b752121e1b2ea096f84dcdc9a6a1a245e87193657fb210d91be4a2a2
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
- attributes.each do |attribute|
41
- # TODO: handle splat attributes
42
- next if attribute.splat?
40
+ splats = []
43
41
 
44
- var_name = prefixed_variable_name(attribute.name, prefix)
45
- args = args.deep_merge(dash_to_hash(attribute.name, var_name))
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
- hash_to_args_list(args)
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
@@ -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
- # TODO: Determine whether the node is an html_tag, component, or slot node
122
- tmp = unique_name
123
- splats = @attributes_compiler.compile_splat_attributes(node.splat_attributes)
124
- code = "content_tag('#{node.tag}', #{splats}) do"
125
-
126
- [:multi,
127
- [:block, "#{tmp} = #{code}", compile(content)],
128
- [:escape, true, [:dynamic, tmp]]]
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ORB
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orb_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - KUY.io Inc.