rux 1.1.0 → 1.1.1
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/CHANGELOG.md +4 -0
- data/lib/rux/ast/tag_node.rb +4 -0
- data/lib/rux/default_visitor.rb +2 -2
- data/lib/rux/utils.rb +2 -2
- data/lib/rux/version.rb +1 -1
- data/spec/parser_spec.rb +18 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bce30eb18d21630d6f5734554e7f81d24443cad2b97134127a606c2f9f0c341
|
4
|
+
data.tar.gz: 8925dcc3f10f9a21f03951c27218f17c9e6dc491a8b3c08864d5cd06650ccf07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa4a8295e55aa4bc1be19afbba78f61633ed384752f85f3f19e61e1b5c8566e8ccb26a354bf679c95e671082eefdbb7b66fc7edefbaf57c8527bf66eb2b3d03a
|
7
|
+
data.tar.gz: 4ae2860e39d8ea6ec56b1c4679b4ffd4418a5fa83ba1b30ac71137938e9f66267aecdbd2ef65d4f141108df5f5a99a305b2e051bfdcc513172c7f48f0859eb96
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 1.1.1
|
2
|
+
* Don't slugify HTML attributes.
|
3
|
+
- Previously rux would emit `<div data-foo="bar">` as `<div data_foo="bar">` because it treated HTML attributes as if they were being passed as Ruby arguments, which don't allow dashes. If these arguments are passed to a component initializer, then they must be slugified, but HTML attributes shouldn't be affected.
|
4
|
+
|
1
5
|
# 1.1.0
|
2
6
|
* Remove newlines between elements. (@aalin, #3)
|
3
7
|
|
data/lib/rux/ast/tag_node.rb
CHANGED
data/lib/rux/default_visitor.rb
CHANGED
@@ -22,10 +22,10 @@ module Rux
|
|
22
22
|
|
23
23
|
at = node.attrs.each_with_object([]) do |(k, v), ret|
|
24
24
|
next if k == 'as'
|
25
|
-
ret << Utils.attr_to_hash_elem(k, visit(v))
|
25
|
+
ret << Utils.attr_to_hash_elem(k, visit(v), slugify: node.component?)
|
26
26
|
end
|
27
27
|
|
28
|
-
if node.
|
28
|
+
if node.component?
|
29
29
|
result << "render(#{node.name}.new"
|
30
30
|
|
31
31
|
unless node.attrs.empty?
|
data/lib/rux/utils.rb
CHANGED
data/lib/rux/version.rb
CHANGED
data/spec/parser_spec.rb
CHANGED
@@ -270,4 +270,22 @@ describe Rux::Parser do
|
|
270
270
|
}
|
271
271
|
RUBY
|
272
272
|
end
|
273
|
+
|
274
|
+
it 'slugifies ruby arguments' do
|
275
|
+
code = <<~RUX
|
276
|
+
<Hello data-foo="bar" />
|
277
|
+
RUX
|
278
|
+
expect(compile(code)).to eq(<<~RUBY.strip)
|
279
|
+
render(Hello.new(data_foo: "bar"))
|
280
|
+
RUBY
|
281
|
+
end
|
282
|
+
|
283
|
+
it 'does not slugify HTML attributes' do
|
284
|
+
code = <<~RUX
|
285
|
+
<div data-foo="bar" />
|
286
|
+
RUX
|
287
|
+
expect(compile(code)).to eq(<<~RUBY.strip)
|
288
|
+
Rux.tag("div", { :"data-foo" => "bar" })
|
289
|
+
RUBY
|
290
|
+
end
|
273
291
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
rubygems_version: 3.
|
100
|
+
rubygems_version: 3.4.5
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: A jsx-inspired way to write view components.
|