haml 6.0.4 → 6.0.5

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: 31325683e3bd7edbd6ec19bf99be81bde203ea948059cec704ac260528d6ff8a
4
- data.tar.gz: 053cbe5fb763691b4fcedd4a8c15649e31dea757a0c7f25366849ae49941e840
3
+ metadata.gz: e9efb6d42c07f38f08e6406c470be766f751439a63c0b151aca4040d5ea583d8
4
+ data.tar.gz: 8bcc4b22a87eb105e380990aa1fcfee19c9cf1ae61467e9bb9c3130f81977279
5
5
  SHA512:
6
- metadata.gz: e480bd4afab654ef3ffdc122cb81c78ca773ca5715310dd876a095491b574722a6b574ae685affb41d5d34eca2465bae737eb3496e3a9bf41df55cdbc74261ac
7
- data.tar.gz: 9d6c05804e701bca33709a441fdb815f779143a66ad5664f22c8b15583415b198a07044682ed78fb22f653533b26fa5f8ee5d8f96cc4026478ec32796cc99f59
6
+ metadata.gz: 07ebd7d512eac2b19e8d8d2d2611064a4742ead90ad9e6570e7612dd45535797d4479aa169371105a37f9f9ba32e6066337ef4a772b7430c7d2ac3a519d34ebb
7
+ data.tar.gz: 2fae2a68a205536580450fdd0c1ee1ab2c7f14268a01cc65b225f2115a1b3ee529865c2c184fc9b18e7a2141f6cb08d7a2254f14e0a7d5f61bde477387a114f9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Haml Changelog
2
2
 
3
+ ## 6.0.5
4
+
5
+ * Resurrect `#haml_object_ref` support in an object reference [#1097](https://github.com/haml/haml/issues/1097)
6
+ * This was removed in 6.0.0, and added back in this version.
7
+ * Stop warning `remove_whitespace: true` option.
8
+
3
9
  ## 6.0.4
4
10
 
5
11
  Released on October 2, 2022
data/REFERENCE.md CHANGED
@@ -81,6 +81,32 @@ You can then use it by including the `haml` gem in Ruby code, and using
81
81
  engine = Haml::Template.new { "%p Haml code!" }
82
82
  engine.render #=> "<p>Haml code!</p>\n"
83
83
 
84
+ ### Options
85
+
86
+ Haml understands various configuration options that affect its performance and
87
+ output.
88
+
89
+ In Rails, options can be set by using `Haml::RailsTemplate.set_options` in an initializer:
90
+
91
+ ```ruby
92
+ # config/initializers/haml.rb
93
+ Haml::RailsTemplate.set_options(escape_html: false)
94
+ ```
95
+
96
+ Outside Rails, you can set them by configuring them globally in `Haml::Template.options`:
97
+
98
+ ```ruby
99
+ Haml::Template.options[:escape_html] = false
100
+ ```
101
+
102
+ In sinatra specifically, you can set them in global config with:
103
+ ```ruby
104
+ set :haml, { escape_html: false }
105
+ ```
106
+
107
+ Finally, you can also set them by passing an options hash to `Haml::Engine.new` or `Haml::Template.new`.
108
+ For the complete list of available options, please see `Haml::Engine`.
109
+
84
110
  ## Plain Text
85
111
 
86
112
  A substantial portion of any HTML document is its content, which is plain old
@@ -294,7 +320,19 @@ or using `true` and `false`:
294
320
  %input(selected=true)
295
321
 
296
322
  This feature works only for attributes that are included in
297
- [`Haml::AttributeBuilder::BOOLEAN_ATTRIBUTES`](lib/haml/attribute_builder.rb).
323
+ [`Haml::AttributeBuilder::BOOLEAN_ATTRIBUTES`](lib/haml/attribute_builder.rb),
324
+ as well as `data-` and `aria-` attributes.
325
+
326
+ %input{'data-hidden' => false}
327
+ %input{'aria-hidden' => false}
328
+ %input{'xyz-hidden' => false}
329
+
330
+ will render as:
331
+
332
+ <input>
333
+ <input>
334
+ <input xyz-hidden='false'>
335
+
298
336
 
299
337
  <!-- The title to the next section (Prefixed Attributes) has changed. This
300
338
  <a> tag is so old links to here still work. -->
data/lib/haml/engine.rb CHANGED
@@ -23,6 +23,7 @@ module Haml
23
23
  param source track wbr),
24
24
  filename: "",
25
25
  disable_capture: false,
26
+ remove_whitespace: false,
26
27
  )
27
28
 
28
29
  use Parser
@@ -6,7 +6,12 @@ module Haml
6
6
  object, prefix = args
7
7
  return {} unless object
8
8
 
9
- suffix = underscore(object.class)
9
+ suffix =
10
+ if object.respond_to?(:haml_object_ref)
11
+ object.haml_object_ref
12
+ else
13
+ underscore(object.class)
14
+ end
10
15
  {
11
16
  'class' => [prefix, suffix].compact.join('_'),
12
17
  'id' => [prefix, suffix, object.id || 'new'].compact.join('_'),
data/lib/haml/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Haml
3
- VERSION = '6.0.4'
3
+ VERSION = '6.0.5'
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.0.4
4
+ version: 6.0.5
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: 2022-10-03 00:00:00.000000000 Z
15
+ date: 2022-10-05 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: temple