arbre 1.5.0 → 1.7.0

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: 167ce642a1b64eb122a2d02ce8a1d738a0c480303769ad7a896df8afbfa2f197
4
- data.tar.gz: 0a4a5d4b7e788155b66eeca1dfdae4ed138403449cda43d915e76fd52bdbdb84
3
+ metadata.gz: 07b4de63d2e89a8ce69753438867bb05800ddc812b83bb630369dfbaec3df59d
4
+ data.tar.gz: 8299e5287279509ec6578db4686114852e92ed0d386ceeeed22cbd7d1170fc02
5
5
  SHA512:
6
- metadata.gz: 31df82dc237aeb220e55fa3ae4bc1fb6d39cb7189cffe36ad2f4839a01ead4336cd1f556a7005ebfb608d258988407db479d9cef855c68016f0b646279e8a2a6
7
- data.tar.gz: 53b572e7001fccc30d284865292613b3f33a35e73f7c4f95a56db7c6c4e96b42721c73d87130b7fc1c402b04acdd2562106efec0c8d7b60ef1ee8bd7bd5034c5
6
+ metadata.gz: 9c01bb198d89bf938f853b2e0a4a674625cae8dfbd0fc56ed5fcc8bee974f92b451af63fd10b927c4ea61fcb88e6e78c81be8d2d3d8fe732347ca4b076b223c9
7
+ data.tar.gz: 020135f9ed8db3a1d085e623250fb33e90d98591960d0ef68251f81e8ec9a93d82c42daff18b539a5884d1a431819a678a8cd046327fb0815b43504069d46d7f
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## Master (unreleased)
4
4
 
5
+ ## 1.7.0 [☰](https://github.com/activeadmin/arbre/compare/v1.6.0...v1.7.0)
6
+
7
+ * Remove upper bound dependency limits from gemspec. [#539][] by [@javierjulio][]
8
+ * Allow ActiveSupport 7.1. [#537][] by [@tomascco][]
9
+
10
+ ## 1.6.0 [☰](https://github.com/activeadmin/arbre/compare/v1.5.0...v1.6.0)
11
+
12
+ * Drop support for Ruby 2.6. [#345][] by [@alejandroperea][]
13
+ * Add 'main' to HTML5 elements. [#270][] by [@mynnx][]
14
+ * Support nested attribute hashes rendered as hyphenated attributes. [#451][] [@Ikariusrb][]
15
+ * Lazy-load rails interactions. [#456][] [@ngan][]
16
+
5
17
  ## 1.5.0 [☰](https://github.com/activeadmin/arbre/compare/v1.4.0...v1.5.0)
6
18
 
7
19
  * Avoid mutating string literals. [#292][] by [@tomgilligan][]
@@ -36,7 +48,7 @@ _No changes_.
36
48
  ## 1.1.1 [☰](https://github.com/activeadmin/arbre/compare/v1.1.0...v1.1.1)
37
49
 
38
50
  * Use mime-types 2.x for Ruby 1.9 by [@timoschilling][]
39
- * Verify Ruby 2.3 support. [#59][] by [@dlackty][]
51
+ * Verify Ruby 2.3 support. [#59][] by [@dlackty][]
40
52
 
41
53
  ## 1.1.0 [☰](https://github.com/activeadmin/arbre/compare/v1.0.3...v1.1.0)
42
54
 
@@ -105,10 +117,16 @@ Initial release and extraction from Active Admin
105
117
  [#202]: https://github.com/activeadmin/arbre/pull/202
106
118
  [#205]: https://github.com/activeadmin/arbre/pull/205
107
119
  [#242]: https://github.com/activeadmin/arbre/pull/242
120
+ [#270]: https://github.com/activeadmin/arbre/pull/270
108
121
  [#292]: https://github.com/activeadmin/arbre/pull/292
109
122
  [#314]: https://github.com/activeadmin/arbre/pull/314
110
123
  [#315]: https://github.com/activeadmin/arbre/pull/315
111
124
  [#318]: https://github.com/activeadmin/arbre/pull/318
125
+ [#345]: https://github.com/activeadmin/arbre/pull/345
126
+ [#451]: https://github.com/activeadmin/arbre/pull/451
127
+ [#456]: https://github.com/activeadmin/arbre/pull/456
128
+ [#537]: https://github.com/activeadmin/arbre/pull/537
129
+ [#539]: https://github.com/activeadmin/arbre/pull/539
112
130
 
113
131
  [@aramvisser]: https://github.com/aramvisser
114
132
  [@LTe]: https://github.com/LTe
@@ -127,3 +145,8 @@ Initial release and extraction from Active Admin
127
145
  [@varyonic]: https://github.com/varyonic
128
146
  [@tagliala]: https://github.com/tagliala
129
147
  [@tomgilligan]: https://github.com/tomgilligan
148
+ [@mynnx]: https://github.com/mynnx
149
+ [@Ikariusrb]: https://github.com/Ikariusrb
150
+ [@ngan]: https://github.com/ngan
151
+ [@tomascco]: https://github.com/tomascco
152
+ [@javierjulio]: https://github.com/javierjulio
data/lib/arbre/context.rb CHANGED
@@ -30,7 +30,7 @@ module Arbre
30
30
  # Initialize a new Arbre::Context
31
31
  #
32
32
  # @param [Hash] assigns A hash of objecs that you would like to be
33
- # availble as local variables within the Context
33
+ # available as local variables within the Context
34
34
  #
35
35
  # @param [Object] helpers An object that has methods on it which will become
36
36
  # instance methods within the context.
@@ -100,7 +100,7 @@ module Arbre
100
100
 
101
101
 
102
102
  # Caches the rendered HTML so that we don't re-render just to
103
- # get the content lenght or to delegate a method to the HTML
103
+ # get the content length or to delegate a method to the HTML
104
104
  def cached_html
105
105
  if defined?(@cached_html)
106
106
  @cached_html
@@ -5,7 +5,7 @@ module Arbre
5
5
  class Attributes < Hash
6
6
 
7
7
  def to_s
8
- map do |name, value|
8
+ flatten_hash.map do |name, value|
9
9
  next if value_empty?(value)
10
10
  "#{html_escape(name)}=\"#{html_escape(value)}\""
11
11
  end.compact.join ' '
@@ -17,6 +17,18 @@ module Arbre
17
17
 
18
18
  protected
19
19
 
20
+ def flatten_hash(hash = self, old_path = [], accumulator = {})
21
+ hash.each do |key, value|
22
+ path = old_path + [key]
23
+ if value.is_a? Hash
24
+ flatten_hash(value, path, accumulator)
25
+ else
26
+ accumulator[path.join('-')] = value
27
+ end
28
+ end
29
+ accumulator
30
+ end
31
+
20
32
  def value_empty?(value)
21
33
  value.respond_to?(:empty?) ? value.empty? : !value
22
34
  end
@@ -6,9 +6,9 @@ module Arbre
6
6
  :bdo, :blockquote, :body, :br, :button, :canvas, :caption, :cite,
7
7
  :code, :col, :colgroup, :command, :datalist, :dd, :del, :details,
8
8
  :dfn, :div, :dl, :dt, :em, :embed, :fieldset, :figcaption, :figure,
9
- :footer, :form, :h1, :h2, :h3, :h4, :h5, :h6, :head, :header, :hgroup,
10
- :hr, :html, :i, :iframe, :img, :input, :ins, :keygen, :kbd, :label,
11
- :legend, :li, :link, :map, :mark, :menu, :menuitem, :meta, :meter, :nav, :noscript,
9
+ :footer, :form, :h1, :h2, :h3, :h4, :h5, :h6, :head, :header, :hgroup,
10
+ :hr, :html, :i, :iframe, :img, :input, :ins, :keygen, :kbd, :label,
11
+ :legend, :li, :link, :main, :map, :mark, :menu, :menuitem, :meta, :meter, :nav, :noscript,
12
12
  :object, :ol, :optgroup, :option, :output, :param, :pre, :progress, :q,
13
13
  :s, :samp, :script, :section, :select, :small, :source, :span,
14
14
  :strong, :style, :sub, :summary, :sup, :svg, :table, :tbody, :td,
@@ -92,5 +92,3 @@ module Arbre
92
92
  end
93
93
  end
94
94
  end
95
-
96
-
@@ -12,7 +12,6 @@ module Arbre
12
12
  text_node rendered
13
13
  end
14
14
  end
15
-
16
15
  end
17
16
  end
18
17
  end
@@ -14,5 +14,3 @@ module Arbre
14
14
  end
15
15
  end
16
16
  end
17
-
18
- ActionView::Template.register_template_handler :arb, Arbre::Rails::TemplateHandler.new
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ require 'arbre/rails/template_handler'
3
+ require 'arbre/rails/forms'
4
+ require 'arbre/rails/rendering'
5
+ require 'rails'
6
+
7
+ Arbre::Element.include(Arbre::Rails::Rendering)
8
+
9
+ module Arbre
10
+ class Railtie < ::Rails::Railtie
11
+ initializer "arbre" do
12
+ ActiveSupport.on_load(:action_view) do
13
+ ActionView::Template.register_template_handler :arb, Arbre::Rails::TemplateHandler.new
14
+ end
15
+ end
16
+ end
17
+ end
data/lib/arbre/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Arbre
3
- VERSION = "1.5.0"
3
+ VERSION = "1.7.0"
4
4
  end
data/lib/arbre.rb CHANGED
@@ -17,5 +17,5 @@ require 'arbre/html/html5_elements'
17
17
  require 'arbre/component'
18
18
 
19
19
  if defined?(Rails)
20
- require 'arbre/rails'
20
+ require 'arbre/railtie'
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arbre
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Bell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-08 00:00:00.000000000 Z
11
+ date: 2023-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.0.0
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '7.1'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 3.0.0
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '7.1'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: ruby2_keywords
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -37,9 +31,6 @@ dependencies:
37
31
  - - ">="
38
32
  - !ruby/object:Gem::Version
39
33
  version: 0.0.2
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '1.0'
43
34
  type: :runtime
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
@@ -47,9 +38,6 @@ dependencies:
47
38
  - - ">="
48
39
  - !ruby/object:Gem::Version
49
40
  version: 0.0.2
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '1.0'
53
41
  description: Arbre makes it easy to generate HTML directly in Ruby
54
42
  email:
55
43
  - gregdbell@gmail.com
@@ -85,15 +73,16 @@ files:
85
73
  - lib/arbre/html/html5_elements.rb
86
74
  - lib/arbre/html/tag.rb
87
75
  - lib/arbre/html/text_node.rb
88
- - lib/arbre/rails.rb
89
76
  - lib/arbre/rails/forms.rb
90
77
  - lib/arbre/rails/rendering.rb
91
78
  - lib/arbre/rails/template_handler.rb
79
+ - lib/arbre/railtie.rb
92
80
  - lib/arbre/version.rb
93
81
  homepage: https://github.com/activeadmin/arbre
94
82
  licenses:
95
83
  - MIT
96
- metadata: {}
84
+ metadata:
85
+ rubygems_mfa_required: 'true'
97
86
  post_install_message:
98
87
  rdoc_options: []
99
88
  require_paths:
@@ -102,14 +91,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
91
  requirements:
103
92
  - - ">="
104
93
  - !ruby/object:Gem::Version
105
- version: '2.6'
94
+ version: '2.7'
106
95
  required_rubygems_version: !ruby/object:Gem::Requirement
107
96
  requirements:
108
97
  - - ">="
109
98
  - !ruby/object:Gem::Version
110
99
  version: '0'
111
100
  requirements: []
112
- rubygems_version: 3.3.6
101
+ rubygems_version: 3.4.13
113
102
  signing_key:
114
103
  specification_version: 4
115
104
  summary: An Object Oriented DOM Tree in Ruby
data/lib/arbre/rails.rb DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'arbre/rails/template_handler'
3
- require 'arbre/rails/forms'
4
- require 'arbre/rails/rendering'
5
-
6
- Arbre::Element.send :include, Arbre::Rails::Rendering