haml 6.2.1 → 6.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 +5 -0
- data/lib/haml/attribute_builder.rb +2 -9
- data/lib/haml/attribute_compiler.rb +10 -5
- data/lib/haml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faa2c94b5f7453469904cc8f4054af08e35cdd99905e24ce85a502c19bcc9d18
|
4
|
+
data.tar.gz: '09f1b8d5cacb30d4f10acc89f0ad7df6d523c3afb16d26eb20c02a45874372fe'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 564b6fdbcff4cf3539635dff2b6f9e482e927bccc4f723f9038355fd4ced189ae0bdd9195885c4e76a6fc7e1c60a7ed2bd9587e912ca3f75a04fd0df7369e75c
|
7
|
+
data.tar.gz: a177490474b02d7febb02930b15ab1db4297fb00d6cff0e04394e322779b38a221b9ebfbbea7357b46774c2d8ba4e0cf0d79a3f50d859cbf4522ce0ba1e261a0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Haml Changelog
|
2
2
|
|
3
|
+
## 6.2.2
|
4
|
+
|
5
|
+
* Allow adding custom attributes to `Haml::BOOLEAN_ATTRIBUTES` [#1148](https://github.com/haml/haml/issues/1148)
|
6
|
+
* Consider `aria-xxx: false` as a boolean attribute
|
7
|
+
|
3
8
|
## 6.2.1
|
4
9
|
|
5
10
|
* Fix v6.2.0's bug in rendering dynamic `aria` attributes [#1149](https://github.com/haml/haml/issues/1149)
|
@@ -2,15 +2,8 @@
|
|
2
2
|
require 'haml/object_ref'
|
3
3
|
|
4
4
|
module Haml::AttributeBuilder
|
5
|
-
BOOLEAN_ATTRIBUTES = %w[disabled readonly multiple checked autobuffer
|
6
|
-
autoplay controls loop selected hidden scoped async
|
7
|
-
defer reversed ismap seamless muted required
|
8
|
-
autofocus novalidate formnovalidate open pubdate
|
9
|
-
itemscope allowfullscreen default inert sortable
|
10
|
-
truespeed typemustmatch download].freeze
|
11
|
-
|
12
5
|
class << self
|
13
|
-
def build(escape_attrs, quote, format,
|
6
|
+
def build(escape_attrs, quote, format, object_ref, *hashes)
|
14
7
|
hashes << Haml::ObjectRef.parse(object_ref) if object_ref
|
15
8
|
buf = []
|
16
9
|
hash = merge_all_attrs(hashes)
|
@@ -26,7 +19,7 @@ module Haml::AttributeBuilder
|
|
26
19
|
buf << build_data(escape_attrs, quote, *hash[key])
|
27
20
|
when 'aria'
|
28
21
|
buf << build_aria(escape_attrs, quote, *hash[key])
|
29
|
-
when *
|
22
|
+
when *Haml::BOOLEAN_ATTRIBUTES, /\Adata-/, /\Aaria-/
|
30
23
|
build_boolean!(escape_attrs, quote, format, buf, key, hash[key])
|
31
24
|
else
|
32
25
|
buf << " #{key}=#{quote}#{escape_html(escape_attrs, hash[key].to_s)}#{quote}"
|
@@ -4,6 +4,14 @@ require 'haml/attribute_parser'
|
|
4
4
|
require 'haml/ruby_expression'
|
5
5
|
|
6
6
|
module Haml
|
7
|
+
# The list of boolean attributes. You may add custom attributes to this constant.
|
8
|
+
BOOLEAN_ATTRIBUTES = %w[disabled readonly multiple checked autobuffer
|
9
|
+
autoplay controls loop selected hidden scoped async
|
10
|
+
defer reversed ismap seamless muted required
|
11
|
+
autofocus novalidate formnovalidate open pubdate
|
12
|
+
itemscope allowfullscreen default inert sortable
|
13
|
+
truespeed typemustmatch download]
|
14
|
+
|
7
15
|
class AttributeCompiler
|
8
16
|
def initialize(identity, options)
|
9
17
|
@identity = identity
|
@@ -31,10 +39,7 @@ module Haml
|
|
31
39
|
attrs = []
|
32
40
|
attrs.unshift(node.value[:attributes].inspect) if node.value[:attributes] != {}
|
33
41
|
|
34
|
-
args = [
|
35
|
-
@escape_attrs.inspect, "#{@quote.inspect}.freeze", @format.inspect,
|
36
|
-
'::Haml::AttributeBuilder::BOOLEAN_ATTRIBUTES', node.value[:object_ref],
|
37
|
-
] + attrs
|
42
|
+
args = [@escape_attrs.inspect, "#{@quote.inspect}.freeze", @format.inspect, node.value[:object_ref]] + attrs
|
38
43
|
[:html, :attrs, [:dynamic, "::Haml::AttributeBuilder.build(#{args.join(', ')}, #{node.value[:dynamic_attributes].to_literal})"]]
|
39
44
|
end
|
40
45
|
|
@@ -52,7 +57,7 @@ module Haml
|
|
52
57
|
compile_class!(temple, key, values)
|
53
58
|
when 'data', 'aria'
|
54
59
|
compile_data!(temple, key, values)
|
55
|
-
when *
|
60
|
+
when *BOOLEAN_ATTRIBUTES, /\Adata-/, /\Aaria-/
|
56
61
|
compile_boolean!(temple, key, values)
|
57
62
|
else
|
58
63
|
compile_common!(temple, key, values)
|
data/lib/haml/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.2.
|
4
|
+
version: 6.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Natalie Weizenbaum
|
@@ -337,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
337
337
|
- !ruby/object:Gem::Version
|
338
338
|
version: '0'
|
339
339
|
requirements: []
|
340
|
-
rubygems_version: 3.
|
340
|
+
rubygems_version: 3.3.26
|
341
341
|
signing_key:
|
342
342
|
specification_version: 4
|
343
343
|
summary: An elegant, structured (X)HTML/XML templating engine.
|