arbre 2.2.1 → 2.2.2
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/arbre/html/attributes.rb +13 -1
- data/lib/arbre/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d6c73932efa49930da9c83f9cbce96a88ef82923b31e29b60626c04150bc04df
|
|
4
|
+
data.tar.gz: 2db087650ed317798f2acb0b2be2d589b72ea5f59a8c40242be094fdea30df53
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b788295b41924036e4671874b87866c878601ebbed1de024873b9428afa8535b613e0e1225e226e9e7c96c0652a842013188a4d73923a4e99ba44fd07c8de0f5
|
|
7
|
+
data.tar.gz: a9c000bb438de18ad4591a10939179f64a314ef76d19064b597680caced36429abb5d28c45ea4dc60af3a837e313ca17e9f3b4b91e1e59da5078412fc1236f1a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.2.2 [☰](https://github.com/activeadmin/arbre/compare/v2.2.1...v2.2.2)
|
|
4
|
+
|
|
5
|
+
* Replace characters that are not allowed in attribute names with `_`
|
|
6
|
+
|
|
3
7
|
## 2.2.1 [☰](https://github.com/activeadmin/arbre/compare/v2.2.0...v2.2.1)
|
|
4
8
|
|
|
5
9
|
* Ensure Arbre context is properly reset after rendering [#700][] by [@drcapulet][]
|
|
@@ -3,9 +3,15 @@ module Arbre
|
|
|
3
3
|
module HTML
|
|
4
4
|
|
|
5
5
|
class Attributes < Hash
|
|
6
|
+
# Controls, space, ", ', /, = and >, which are not allowed in attribute
|
|
7
|
+
# names. Matched as bytes so names in any ASCII-compatible encoding work.
|
|
8
|
+
INVALID_NAME_CHARACTERS = %r{[\x00-\x20\x7F"'/=>]}n
|
|
9
|
+
# Also matches U+0080 to U+009F, the C1 controls encoded as UTF-8
|
|
10
|
+
INVALID_UTF8_NAME_CHARACTERS = %r{[\x00-\x20\x7F"'/=>]|\xC2[\x80-\x9F]}n
|
|
11
|
+
|
|
6
12
|
def to_s
|
|
7
13
|
flatten_hash.compact.map do |name, value|
|
|
8
|
-
"#{html_escape(name)}=\"#{html_escape(value)}\""
|
|
14
|
+
"#{html_escape(attribute_name(name))}=\"#{html_escape(value)}\""
|
|
9
15
|
end.join ' '
|
|
10
16
|
end
|
|
11
17
|
|
|
@@ -23,6 +29,12 @@ module Arbre
|
|
|
23
29
|
accumulator
|
|
24
30
|
end
|
|
25
31
|
|
|
32
|
+
def attribute_name(name)
|
|
33
|
+
name = name.to_s
|
|
34
|
+
invalid = name.encoding == Encoding::UTF_8 ? INVALID_UTF8_NAME_CHARACTERS : INVALID_NAME_CHARACTERS
|
|
35
|
+
name.b.gsub(invalid, '_').force_encoding(name.encoding)
|
|
36
|
+
end
|
|
37
|
+
|
|
26
38
|
def html_escape(s)
|
|
27
39
|
ERB::Util.html_escape(s)
|
|
28
40
|
end
|
data/lib/arbre/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: arbre
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Greg Bell
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-12-03 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: activesupport
|
|
@@ -68,6 +69,7 @@ licenses:
|
|
|
68
69
|
- MIT
|
|
69
70
|
metadata:
|
|
70
71
|
rubygems_mfa_required: 'true'
|
|
72
|
+
post_install_message:
|
|
71
73
|
rdoc_options: []
|
|
72
74
|
require_paths:
|
|
73
75
|
- lib
|
|
@@ -82,7 +84,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
82
84
|
- !ruby/object:Gem::Version
|
|
83
85
|
version: '0'
|
|
84
86
|
requirements: []
|
|
85
|
-
rubygems_version: 3.
|
|
87
|
+
rubygems_version: 3.4.19
|
|
88
|
+
signing_key:
|
|
86
89
|
specification_version: 4
|
|
87
90
|
summary: An Object Oriented DOM Tree in Ruby
|
|
88
91
|
test_files: []
|