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 +4 -4
- data/CHANGELOG.md +10 -1
- data/FAQ.md +1 -1
- data/README.md +5 -5
- data/REFERENCE.md +25 -29
- data/lib/haml/attribute_builder.rb +8 -13
- data/lib/haml/attribute_compiler.rb +10 -5
- data/lib/haml/version.rb +1 -1
- 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: 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,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="
|
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](
|
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)](
|
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](
|
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](
|
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](
|
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](
|
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
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
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
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
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,
|
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'
|
14
|
+
when 'id'
|
22
15
|
buf << " id=#{quote}#{build_id(escape_attrs, *hash[key])}#{quote}"
|
23
|
-
when 'class'
|
16
|
+
when 'class'
|
24
17
|
buf << " class=#{quote}#{build_class(escape_attrs, *hash[key])}#{quote}"
|
25
|
-
when 'data'
|
18
|
+
when 'data'
|
26
19
|
buf << build_data(escape_attrs, quote, *hash[key])
|
27
|
-
when
|
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'
|
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 *
|
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
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: exe
|
14
14
|
cert_chain: []
|
15
|
-
date: 2023-
|
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.
|
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.
|