haml 6.0.0 → 6.0.1

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: 0b9bc0a9bea79d404adbf4b0eb540dd256a53c4c99a71f88a2bd25b1b313685a
4
- data.tar.gz: 7d76a5280aa58671b319d08776d1c93785e3ea71f9664fc40a2602f229c3a55a
3
+ metadata.gz: 909d5636fba736ef06747221b4d0ff34a8c5b850f2c8d4cc60ac27843e914e94
4
+ data.tar.gz: 478fd2cce0e05e386690aa83fa41132da006cb02437ec43a0b4882842a2e973c
5
5
  SHA512:
6
- metadata.gz: 5d44ef26e2b98dfab93bc7e825dc6f10bc5d86c35cb094fd634b127c7da86c4512ee839cd4f0944b0c4abeac577e94d5bd032aca650a1b70d9b7c97bfeca0a34
7
- data.tar.gz: 5c0c3c3689ddca67701c439d96990126663cd52b97107a3ca2fc3da38bfba5614cecbacf8049a0bc751e096370bfa4733c1cd24eb9034c21082c2215617f6b29
6
+ metadata.gz: 268bfdc33ba76950ab553692c5ff1c45b84a3f3b4185248a19c6a3a74f4b47cd46527d279ed3782f9b7fd6bba6be889a531b7e6c133a4f00ac7e3e06d61a464c
7
+ data.tar.gz: 1b4f559abe65e3c39627d87b6cc2da894ca67514f62d702ff0920d9d974dda49d4ab7b49e465157622b31a9c3ad5b1925e5e4aa2b1360640d784a7a6f537178a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Haml Changelog
2
2
 
3
+ ## 6.0.1
4
+
5
+ Released on September 23, 2022
6
+ ([diff](https://github.com/haml/haml/compare/v6.0.0...v6.0.1)).
7
+
8
+ * Unescape HTML-safe interpolation on Rails [#1084](https://github.com/haml/haml/issues/1084)
9
+ * Resurrect Haml 5's `AttributeParser.available?` for syntax\_tree-haml [#1085](https://github.com/haml/haml/issues/1085)
10
+
3
11
  ## 6.0.0
4
12
 
5
13
  Released on September 21, 2022
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Haml
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/haml.svg)](http://rubygems.org/gems/haml)
4
- [![Build Status](https://travis-ci.org/haml/haml.svg?branch=main)](http://travis-ci.org/haml/haml)
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](http://inch-ci.org/github/haml/haml.png)](http://inch-ci.org/github/haml/haml)
7
7
 
@@ -14,7 +14,7 @@ module Haml
14
14
 
15
15
  def compile(node)
16
16
  hashes = []
17
- if node.value[:object_ref] != :nil || !Ripper.respond_to?(:lex) # No Ripper.lex in truffleruby
17
+ if node.value[:object_ref] != :nil || !AttributeParser.available?
18
18
  return runtime_compile(node)
19
19
  end
20
20
  [node.value[:dynamic_attributes].new, node.value[:dynamic_attributes].old].compact.each do |attribute_str|
@@ -6,13 +6,19 @@ module Haml
6
6
  class ParseSkip < StandardError
7
7
  end
8
8
 
9
+ # @return [TrueClass, FalseClass] - return true if AttributeParser.parse can be used.
10
+ def self.available?
11
+ # TruffleRuby doesn't have Ripper.lex
12
+ defined?(Ripper) && Ripper.respond_to?(:lex) && Temple::StaticAnalyzer.available?
13
+ end
14
+
9
15
  def self.parse(text)
10
16
  self.new.parse(text)
11
17
  end
12
18
 
13
19
  def parse(text)
14
20
  exp = wrap_bracket(text)
15
- return if RubyExpression.syntax_error?(exp)
21
+ return if Temple::StaticAnalyzer.syntax_error?(exp)
16
22
 
17
23
  hash = {}
18
24
  tokens = Ripper.lex(exp)[1..-2] || []
data/lib/haml/railtie.rb CHANGED
@@ -4,11 +4,6 @@ require 'rails'
4
4
  module Haml
5
5
  class Railtie < ::Rails::Railtie
6
6
  initializer :haml, before: :load_config_initializers do |app|
7
- # Load haml/plugin first to override if available
8
- begin
9
- require 'haml/plugin'
10
- rescue LoadError
11
- end
12
7
  require 'haml/rails_template'
13
8
  end
14
9
  end
data/lib/haml/util.rb CHANGED
@@ -26,8 +26,9 @@ module Haml
26
26
  require 'haml/haml' # Haml::Util.escape_html
27
27
  end
28
28
 
29
+ # TODO: Remove unescape_interpolation's workaround and get rid of `respond_to?`.
29
30
  def self.escape_html_safe(html)
30
- html.html_safe? ? html : escape_html(html)
31
+ (html.respond_to?(:html_safe?) && html.html_safe?) ? html : escape_html(html)
31
32
  end
32
33
 
33
34
  # Silence all output to STDERR within a block.
@@ -216,7 +217,7 @@ MSG
216
217
  end
217
218
  content = eval("\"#{interpolated}\"")
218
219
  content = "#{char}#{content}" if char == '@' || char == '$'
219
- content = "CGI.escapeHTML((#{content}).to_s)" if escape_html
220
+ content = "Haml::Util.escape_html_safe((#{content}).to_s)" if escape_html
220
221
 
221
222
  res << "\#{#{content}}"
222
223
  end
data/lib/haml/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Haml
3
- VERSION = '6.0.0'
3
+ VERSION = '6.0.1'
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.0
4
+ version: 6.0.1
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-09-21 00:00:00.000000000 Z
15
+ date: 2022-09-23 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: temple