haml 6.2.0 → 6.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1374065239926b78aa88c8a9669a4a97ea937ba078f4794be6d3d34c072472e
4
- data.tar.gz: a99b6d11b903d2d9985e6e89d857b24c4ca5c31efe2a0c09d29cfea7b58a2057
3
+ metadata.gz: faa2c94b5f7453469904cc8f4054af08e35cdd99905e24ce85a502c19bcc9d18
4
+ data.tar.gz: '09f1b8d5cacb30d4f10acc89f0ad7df6d523c3afb16d26eb20c02a45874372fe'
5
5
  SHA512:
6
- metadata.gz: '05423907d445d38fbba24d1b08f6812b43a8bca544554b5ecc1d1190e87842cedf888cd4759f6d568cb861a0f6983e06610d57daa2233feafb0e29cce92c71b1'
7
- data.tar.gz: e88712e3391749f5c893512eb595c912718476a7128773b4edd4aa19b191837ff3d6d154a18a0c8a42a107d6c04ce4ee6cd3189d6270210d9b4b5ded33def0dc
6
+ metadata.gz: 564b6fdbcff4cf3539635dff2b6f9e482e927bccc4f723f9038355fd4ced189ae0bdd9195885c4e76a6fc7e1c60a7ed2bd9587e912ca3f75a04fd0df7369e75c
7
+ data.tar.gz: a177490474b02d7febb02930b15ab1db4297fb00d6cff0e04394e322779b38a221b9ebfbbea7357b46774c2d8ba4e0cf0d79a3f50d859cbf4522ce0ba1e261a0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
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
+
8
+ ## 6.2.1
9
+
10
+ * Fix v6.2.0's bug in rendering dynamic `aria` attributes [#1149](https://github.com/haml/haml/issues/1149)
11
+
3
12
  ## 6.2.0
4
13
 
5
14
  * Drop the C extension [#1146](https://github.com/haml/haml/issues/1146)
@@ -1448,7 +1457,7 @@ Haml 2.2 introduces a new syntax for attributes
1448
1457
  based on the HTML syntax.
1449
1458
  For example:
1450
1459
 
1451
- %a(href="http://haml.info" title="Haml's so cool!")
1460
+ %a(href="https://haml.info" title="Haml's so cool!")
1452
1461
  %img(src="/images/haml.png" alt="Haml")
1453
1462
 
1454
1463
  There are two main reasons for this.
data/FAQ.md CHANGED
@@ -141,7 +141,7 @@ For other plugins, a little searching will probably turn up a way to fix them as
141
141
 
142
142
  ## You still haven't answered my question!
143
143
 
144
- Sorry! Try looking at the [Haml](http://haml.info/docs/yardoc/file.REFERENCE.html) reference,
144
+ Sorry! Try looking at the [Haml](https://haml.info/docs/yardoc/file.REFERENCE.html) reference,
145
145
  If you can't find an answer there,
146
146
  feel free to ask in `#haml` on irc.freenode.net
147
147
  or send an email to the [mailing list](http://groups.google.com/group/haml).
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Haml
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/haml.svg)](http://rubygems.org/gems/haml)
3
+ [![Gem Version](https://badge.fury.io/rb/haml.svg)](https://rubygems.org/gems/haml)
4
4
  [![test](https://github.com/haml/haml/actions/workflows/test.yml/badge.svg)](https://github.com/haml/haml/actions/workflows/test.yml)
5
5
  [![Code Climate](https://codeclimate.com/github/haml/haml/badges/gpa.svg)](https://codeclimate.com/github/haml/haml)
6
6
  [![Inline docs](https://inch-ci.org/github/haml/haml.svg)](https://inch-ci.org/github/haml/haml)
@@ -31,7 +31,7 @@ to compile it to HTML. For more information on these commands, check out
31
31
  haml --help
32
32
  ~~~
33
33
 
34
- To use Haml programmatically, check out the [YARD documentation](http://haml.info/docs/yardoc/).
34
+ To use Haml programmatically, check out the [YARD documentation](https://haml.info/docs/yardoc/).
35
35
 
36
36
  ## Using Haml with Rails
37
37
 
@@ -120,7 +120,7 @@ output the result. You can even use control statements like `if` and `while`:
120
120
  ~~~
121
121
 
122
122
  Haml provides far more tools than those presented here. Check out the [reference
123
- documentation](http://haml.info/docs/yardoc/file.REFERENCE.html)
123
+ documentation](https://haml.info/docs/yardoc/file.REFERENCE.html)
124
124
  for full details.
125
125
 
126
126
  ### Indentation
@@ -132,7 +132,7 @@ can't be mixed, and the same number of tabs or spaces must be used throughout.
132
132
  ## Contributing
133
133
 
134
134
  Contributions are welcomed, but before you get started please read the
135
- [guidelines](http://haml.info/development.html#contributing).
135
+ [guidelines](https://haml.info/development.html#contributing).
136
136
 
137
137
  After forking and then cloning the repo locally, install Bundler and then use it
138
138
  to install the development gem dependencies:
@@ -182,7 +182,7 @@ but still consults on language issues.
182
182
  [Natalie Weizenbaum](http://nex-3.com) was for many years the primary developer
183
183
  and architect of the "modern" Ruby implementation of Haml.
184
184
 
185
- [Norman Clarke](http://github.com/norman) was the primary maintainer of Haml from 2012 to 2016.
185
+ [Norman Clarke](https://github.com/norman) was the primary maintainer of Haml from 2012 to 2016.
186
186
 
187
187
  ## License
188
188
 
data/REFERENCE.md CHANGED
@@ -1200,40 +1200,36 @@ You can also define your own filters.
1200
1200
 
1201
1201
  The simplest example of a filter might be something like:
1202
1202
 
1203
- ```ruby
1204
- class HelloFilter < Haml::Filters::Base
1205
- def compile(_node)
1206
- [:static, "hello world"]
1207
- end
1208
- end
1209
-
1210
- Haml::Filters.registered[:hello] ||= HelloFilter
1211
- ```
1203
+ class HelloFilter < Haml::Filters::Base
1204
+ def compile(_node)
1205
+ [:static, "hello world"]
1206
+ end
1207
+ end
1208
+
1209
+ Haml::Filters.registered[:hello] ||= HelloFilter
1212
1210
 
1213
1211
  A more complex example:
1214
1212
 
1215
- ```ruby
1216
- class BetterFilter < Haml::Filters::Base
1217
- def compile(node)
1218
- temple = [:multi]
1219
- temple << [:static, "hello "]
1220
- temple << compile_text(node.value[:text])
1221
- temple << [:static, " world"]
1222
- temple
1223
- end
1224
-
1225
- private
1226
- def compile_text(text)
1227
- if ::Haml::Util.contains_interpolation?(text)
1228
- [:dynamic, ::Haml::Util.unescape_interpolation(text)]
1229
- else
1230
- [:static, text]
1213
+ class BetterFilter < Haml::Filters::Base
1214
+ def compile(node)
1215
+ temple = [:multi]
1216
+ temple << [:static, "hello "]
1217
+ temple << compile_text(node.value[:text])
1218
+ temple << [:static, " world"]
1219
+ temple
1220
+ end
1221
+
1222
+ private
1223
+ def compile_text(text)
1224
+ if ::Haml::Util.contains_interpolation?(text)
1225
+ [:dynamic, ::Haml::Util.unescape_interpolation(text)]
1226
+ else
1227
+ [:static, text]
1228
+ end
1229
+ end
1231
1230
  end
1232
- end
1233
- end
1234
1231
 
1235
- Haml::Filters.registered[:better] ||= BetterFilter
1236
- ```
1232
+ Haml::Filters.registered[:better] ||= BetterFilter
1237
1233
 
1238
1234
  See {Haml::Filters} for examples.
1239
1235
 
@@ -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, boolean_attributes, object_ref, *hashes)
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)
@@ -18,13 +11,15 @@ module Haml::AttributeBuilder
18
11
  keys = hash.keys.sort!
19
12
  keys.each do |key|
20
13
  case key
21
- when 'id'.freeze
14
+ when 'id'
22
15
  buf << " id=#{quote}#{build_id(escape_attrs, *hash[key])}#{quote}"
23
- when 'class'.freeze
16
+ when 'class'
24
17
  buf << " class=#{quote}#{build_class(escape_attrs, *hash[key])}#{quote}"
25
- when 'data'.freeze
18
+ when 'data'
26
19
  buf << build_data(escape_attrs, quote, *hash[key])
27
- when *boolean_attributes, /\Adata-/
20
+ when 'aria'
21
+ buf << build_aria(escape_attrs, quote, *hash[key])
22
+ when *Haml::BOOLEAN_ATTRIBUTES, /\Adata-/, /\Aaria-/
28
23
  build_boolean!(escape_attrs, quote, format, buf, key, hash[key])
29
24
  else
30
25
  buf << " #{key}=#{quote}#{escape_html(escape_attrs, hash[key].to_s)}#{quote}"
@@ -129,7 +124,7 @@ module Haml::AttributeBuilder
129
124
  hash.each do |key, value|
130
125
  key = key.to_s
131
126
  case key
132
- when 'id'.freeze, 'class'.freeze, 'data'.freeze
127
+ when 'id', 'class', 'data', 'aria'
133
128
  merged[key] ||= []
134
129
  merged[key] << value
135
130
  else
@@ -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 *AttributeBuilder::BOOLEAN_ATTRIBUTES, /\Adata-/, /\Aaria-/
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Haml
3
- VERSION = '6.2.0'
3
+ VERSION = '6.2.2'
4
4
  end
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.0
4
+ version: 6.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Natalie Weizenbaum
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: exe
14
14
  cert_chain: []
15
- date: 2023-09-27 00:00:00.000000000 Z
15
+ date: 2023-10-04 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: temple
@@ -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.4.10
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.