haml 6.1.2 → 6.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f721367f32b443559aa0aa20e75bd7b9d179fffbfff06873cca328f26ae70689
4
- data.tar.gz: dc52332427ab542277bb52374e6c20ba696180caad8a86cd04eee247c6c0f9bb
3
+ metadata.gz: 3d737ee35f4f57bdbbedceeb61233e0b21818fee84a50e00a1e317b2a8efcb50
4
+ data.tar.gz: 6e8a41c9e3a9e8c9db478f0c5ea636a6eb8bb2fe811b609664808edfac204645
5
5
  SHA512:
6
- metadata.gz: 13197f48f55be37cec0eb76bc6b9c2e32d37cc1b3e430a509bb9c362fbb1e8f44fb858f1d39b22a0b2c654dfb6b2c237756a08a4495cf31c42eae59a6ea15c77
7
- data.tar.gz: 073bc4c02899dea76c285bb8561df5631e3553fc3d939e30f94fe1671814ca5c3c812c3bcec251b3f0a562c03a2db606ef9b7e37b3014c50638cf2e29c44c465
6
+ metadata.gz: b298a5a331bf81368054ac7fbae382a4ea739d9b24a8aa2db68ddf0e9595e116d3439ae75ddf73bd16dc943ee5e6fa0bdcd3f693ddf09c5abf54eaacbcfd9b14
7
+ data.tar.gz: b5ebe7e3ae7337224db692aad4c116674a6992e0880f46e96a4e9486d72bf22f57b3d1fb94396353d3b06d680387fbfb24f4dcc7ef0eb17dca4acbc7bc0336e9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Haml Changelog
2
2
 
3
+ ## 6.1.4
4
+
5
+ * Let `Haml::Util.escape_html` use `ERB::Escape` if available [#1145](https://github.com/haml/haml/issues/1145)
6
+
7
+ ## 6.1.3
8
+
9
+ * Add `Haml::RailsTemplate#default_format` for Turbo compatibility [#1144](https://github.com/haml/haml/issues/1144)
10
+
11
+ ## 6.1.2
12
+
13
+ * Use the rails template path as `filename` [#1140](https://github.com/haml/haml/issues/1140)
14
+
3
15
  ## 6.1.1
4
16
 
5
17
  * Fix an empty output of Ruby 3.1's Hash shorthand syntax [#1083](https://github.com/haml/haml/issues/1083)
@@ -102,6 +114,12 @@ Released on September 21, 2022
102
114
  `list_of`, `non_haml`, `precede`, `succeed`, `surround`, `tab_down`, `tab_up`, `with_tabs`
103
115
  * `:ruby` filter
104
116
  * Removed: `haml_io`
117
+ * Alternatives to the removed helpers:
118
+ * Some simple ones could work by copying [the original definition](https://github.com/haml/haml/blob/v5.2.2/lib/haml/helpers.rb).
119
+ * For helpers generating general HTML tags, also consider using what your framework provides, e.g. Rails `content_tag`.
120
+ Same applies to `capture_haml`, e.g. Rails `capture`.
121
+ * Ones that rely on `Haml::Buffer` have no direct alternative by design. They existed at the cost of performance.
122
+ You need to define a helper, instantiate a String buffer in it, append stuff to it, and call it inside `=`.
105
123
  * Only the following attributes and `aria`/`data` attributes are considered boolean attributes:
106
124
  * `allowfullscreen`, `async`, `autobuffer`, `autofocus`, `autoplay`, `checked`, `controls`, `default`,
107
125
  `defer`, `disabled`, `download`, `formnovalidate`, `hidden`, `inert`, `ismap`, `itemscope`, `loop`,
data/ext/haml/haml.c CHANGED
@@ -77,12 +77,6 @@ escape_attribute(VALUE escape_attrs, VALUE str)
77
77
  }
78
78
  }
79
79
 
80
- static VALUE
81
- rb_escape_html(RB_UNUSED_VAR(VALUE self), VALUE value)
82
- {
83
- return escape_html(to_s(value));
84
- }
85
-
86
80
  static VALUE
87
81
  haml_build_id(VALUE escape_attrs, VALUE values)
88
82
  {
@@ -504,14 +498,12 @@ rb_haml_build(int argc, VALUE *argv, RB_UNUSED_VAR(VALUE self))
504
498
  void
505
499
  Init_haml(void)
506
500
  {
507
- VALUE mHaml, mUtil;
501
+ VALUE mHaml;
508
502
 
509
503
  mHaml = rb_define_module("Haml");
510
504
  mObjectRef = rb_define_module_under(mHaml, "ObjectRef");
511
- mUtil = rb_define_module_under(mHaml, "Util");
512
505
  mAttributeBuilder = rb_define_module_under(mHaml, "AttributeBuilder");
513
506
 
514
- rb_define_singleton_method(mUtil, "escape_html", rb_escape_html, 1);
515
507
  rb_define_singleton_method(mAttributeBuilder, "build", rb_haml_build, -1);
516
508
  rb_define_singleton_method(mAttributeBuilder, "build_id", rb_haml_build_id, -1);
517
509
  rb_define_singleton_method(mAttributeBuilder, "build_class", rb_haml_build_class, -1);
@@ -48,6 +48,11 @@ module Haml
48
48
  Engine.new(options).call(source)
49
49
  end
50
50
 
51
+ # Rails Turbo looks for this
52
+ def default_format
53
+ :html
54
+ end
55
+
51
56
  def supports_streaming?
52
57
  RailsTemplate.options[:streaming]
53
58
  end
data/lib/haml/util.rb CHANGED
@@ -14,15 +14,16 @@ module Haml
14
14
  module Util
15
15
  extend self
16
16
 
17
- # For JRuby, TruffleRuby, and Wasm, fallback to Ruby implementation.
18
- if /java|wasm/ === RUBY_PLATFORM || RUBY_ENGINE == 'truffleruby'
17
+ begin # Ruby 3.2+ or ERB 4+
18
+ require 'erb/escape'
19
+
20
+ define_singleton_method(:escape_html, ERB::Escape.instance_method(:html_escape))
21
+ rescue LoadError
19
22
  require 'cgi/escape'
20
23
 
21
24
  def self.escape_html(html)
22
25
  CGI.escapeHTML(html.to_s)
23
26
  end
24
- else
25
- require 'haml/haml' # Haml::Util.escape_html
26
27
  end
27
28
 
28
29
  # 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.1.2'
3
+ VERSION = '6.1.4'
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.1.2
4
+ version: 6.1.4
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-08-12 00:00:00.000000000 Z
15
+ date: 2023-09-27 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: temple
@@ -356,7 +356,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
356
356
  - !ruby/object:Gem::Version
357
357
  version: '0'
358
358
  requirements: []
359
- rubygems_version: 3.4.1
359
+ rubygems_version: 3.4.10
360
360
  signing_key:
361
361
  specification_version: 4
362
362
  summary: An elegant, structured (X)HTML/XML templating engine.