haml 6.0.5-java → 6.0.6-java

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: e590841334e96540c2233dcb64895ca41527d57a4563b25a6ad8454e3efdfc6e
4
- data.tar.gz: 42901be1be77d381f5b2823249c39adf9f19712bd367be8e97046abe97baaada
3
+ metadata.gz: c35af30ae30b1cb93222b654b157683cb06f6ba5255c5bfb882712d8eba32f12
4
+ data.tar.gz: 573262ec4e66e62d2f65707668f1b336c4a9562c4b50ead53033c1f3b8a3ca0d
5
5
  SHA512:
6
- metadata.gz: 2d3d0c153a75ccccea17416c4edd1d8fe6519e618c620d4a5be013bea97094fd262e9075b3b0b725060fd23c59aca21269b89ac7b4564bcdc5734523a9f1397f
7
- data.tar.gz: 3e072c029afc62da06302b6e2faf404afc5f5f22d49c324966e39be622e2693a912d4f671084336fabf1f45141a4e56e645b081a8e3790613dfdf3a1fcdb396a
6
+ metadata.gz: 56407b25cd5595d23a200f47397bae209649f0d410a14e354676b74d07c737666aba0141ff1fd87e663f126b94aaa14dd1d14c6de6f89af6c7bdc7153f281d3c
7
+ data.tar.gz: bd3aea771399867bba9228390a1969868fea6c58468b4b6f618c1ce488f97fea1448f7b8d5f24fd849c3bfe232a6641b7a23ee59309c5f986833e4943ac9391c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Haml Changelog
2
2
 
3
+ ## 6.0.6
4
+
5
+ * Prevent CRuby from accidentally using the Ruby implementation fallback
6
+ * Reversing what v6.0.3 and v6.0.4 did, but still supporting Wasm.
7
+
3
8
  ## 6.0.5
4
9
 
5
10
  * Resurrect `#haml_object_ref` support in an object reference [#1097](https://github.com/haml/haml/issues/1097)
data/REFERENCE.md CHANGED
@@ -1201,6 +1201,44 @@ default. This filter is implemented using Tilt.
1201
1201
  You can also define your own filters.
1202
1202
  `Haml::Filters::YourCustomFilter#compile` should return
1203
1203
  [a Temple expression](https://github.com/judofyr/temple/blob/master/EXPRESSIONS.md).
1204
+
1205
+ The simplest example of a filter might be something like:
1206
+
1207
+ ```ruby
1208
+ class HelloFilter < Haml::Filters::Base
1209
+ def compile(_node)
1210
+ [:static, "hello world"]
1211
+ end
1212
+ end
1213
+
1214
+ Haml::Filters.registered[:hello] ||= HelloFilter
1215
+ ```
1216
+
1217
+ A more complex complex example
1218
+
1219
+ ```ruby
1220
+ class BetterFilter < Haml::Filters::Base
1221
+ def compile(node)
1222
+ temple = [:multi]
1223
+ temple << [:static, "hello "]
1224
+ temple << compile_text(node.value[:text])
1225
+ temple << [:static, " world"]
1226
+ temple
1227
+ end
1228
+
1229
+ private
1230
+ def compile_text(text)
1231
+ if ::Haml::Util.contains_interpolation?(text)
1232
+ [:dynamic, ::Haml::Util.unescape_interpolation(text)]
1233
+ else
1234
+ [:static, text]
1235
+ end
1236
+ end
1237
+ end
1238
+
1239
+ Haml::Filters.registered[:better] ||= BetterFilter
1240
+ ```
1241
+
1204
1242
  See {Haml::Filters} for examples.
1205
1243
 
1206
1244
  ## Multiline: `|` {#multiline}
@@ -9,15 +9,8 @@ module Haml::AttributeBuilder
9
9
  itemscope allowfullscreen default inert sortable
10
10
  truespeed typemustmatch download].freeze
11
11
 
12
- begin
13
- # Haml::AttributeBuilder.build
14
- # Haml::AttributeBuilder.build_id
15
- # Haml::AttributeBuilder.build_class
16
- # Haml::AttributeBuilder.build_data
17
- # Haml::AttributeBuilder.build_aria
18
- require 'haml/haml'
19
- rescue LoadError
20
- # For JRuby and Wasm, fallback to Ruby implementation when C extension is not available.
12
+ # For JRuby, TruffleRuby, and Wasm, fallback to Ruby implementation.
13
+ if /java|wasm/ === RUBY_PLATFORM || RUBY_ENGINE == 'truffleruby'
21
14
  class << self
22
15
  def build(escape_attrs, quote, format, boolean_attributes, object_ref, *hashes)
23
16
  hashes << Haml::ObjectRef.parse(object_ref) if object_ref
@@ -170,5 +163,12 @@ module Haml::AttributeBuilder
170
163
  end
171
164
  end
172
165
  end
166
+ else
167
+ # Haml::AttributeBuilder.build
168
+ # Haml::AttributeBuilder.build_id
169
+ # Haml::AttributeBuilder.build_class
170
+ # Haml::AttributeBuilder.build_data
171
+ # Haml::AttributeBuilder.build_aria
172
+ require 'haml/haml'
173
173
  end
174
174
  end
data/lib/haml/util.rb CHANGED
@@ -14,15 +14,15 @@ module Haml
14
14
  module Util
15
15
  extend self
16
16
 
17
- begin
18
- require 'haml/haml' # Haml::Util.escape_html
19
- rescue LoadError
20
- # For JRuby and Wasm, fallback to Ruby implementation when C extension is not available.
17
+ # For JRuby, TruffleRuby, and Wasm, fallback to Ruby implementation.
18
+ if /java|wasm/ === RUBY_PLATFORM || RUBY_ENGINE == 'truffleruby'
21
19
  require 'cgi/escape'
22
20
 
23
21
  def self.escape_html(html)
24
22
  CGI.escapeHTML(html.to_s)
25
23
  end
24
+ else
25
+ require 'haml/haml' # Haml::Util.escape_html
26
26
  end
27
27
 
28
28
  # TODO: Remove unescape_interpolation's workaround and get rid of `respond_to?`.
data/lib/haml/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Haml
3
- VERSION = '6.0.5'
3
+ VERSION = '6.0.6'
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.5
4
+ version: 6.0.6
5
5
  platform: java
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-05 00:00:00.000000000 Z
15
+ date: 2022-10-09 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  requirement: !ruby/object:Gem::Requirement