haml 6.0.12-java → 6.1.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +3 -1
- data/.github/workflows/test.yml +1 -0
- data/CHANGELOG.md +9 -0
- data/lib/haml/attribute_compiler.rb +1 -1
- data/lib/haml/compiler/script_compiler.rb +1 -3
- data/lib/haml/engine.rb +6 -4
- data/lib/haml/{escapable.rb → escape.rb} +1 -1
- data/lib/haml/escape_any.rb +21 -0
- data/lib/haml/{force_escapable.rb → force_escape.rb} +5 -5
- data/lib/haml/rails_template.rb +3 -1
- data/lib/haml/util.rb +1 -0
- data/lib/haml/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c49120585ee72f608f19985f8429c363574fff21929b9bec48fe6d487673e5e4
|
4
|
+
data.tar.gz: 8b5b3c80441f882ff293fa61ed24db3de70c0c074c851f35f7054475cf1e714f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dfb717d211afae611d67cfdcbdb79f4e952c82eb9058dec7fc7c10d7c85811e81832f80ae53b6a88b9d0c1f8ec511918b7afd4bebd47c7c0128b258117b2f12
|
7
|
+
data.tar.gz: 9d885cb2997cab4bdb80a3c2263c52397126d02de71073b985d283a5971004bd3c3ebde8f7e26d543610c00558d71566525e792ca87035fea276375f67515b6d
|
data/.github/FUNDING.yml
CHANGED
data/.github/workflows/test.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Haml Changelog
|
2
2
|
|
3
|
+
## 6.1.1
|
4
|
+
|
5
|
+
* Fix an empty output of Ruby 3.1's Hash shorthand syntax [#1083](https://github.com/haml/haml/issues/1083)
|
6
|
+
|
7
|
+
## 6.1.0
|
8
|
+
|
9
|
+
* Optimize away a `to_s` call on `=` scripts
|
10
|
+
* Fix escaping for objects that return an `html_safe` string on `to_s` [#1117](https://github.com/haml/haml/issues/1117)
|
11
|
+
|
3
12
|
## 6.0.12
|
4
13
|
|
5
14
|
* Fix a whitespace removal with `>` and an `if`-`else` statement [#1114](https://github.com/haml/haml/issues/1114)
|
@@ -19,7 +19,7 @@ module Haml
|
|
19
19
|
end
|
20
20
|
[node.value[:dynamic_attributes].new, node.value[:dynamic_attributes].old].compact.each do |attribute_str|
|
21
21
|
hash = AttributeParser.parse(attribute_str)
|
22
|
-
return runtime_compile(node)
|
22
|
+
return runtime_compile(node) if hash.nil? || hash.any? { |_key, value| value.empty? }
|
23
23
|
hashes << hash
|
24
24
|
end
|
25
25
|
static_compile(node.value[:attributes], hashes)
|
@@ -98,10 +98,8 @@ module Haml
|
|
98
98
|
def compile_script_result(result, node)
|
99
99
|
if !node.value[:escape_html] && node.value[:preserve]
|
100
100
|
result = find_and_preserve(result)
|
101
|
-
else
|
102
|
-
result = "(#{result}).to_s"
|
103
101
|
end
|
104
|
-
[:
|
102
|
+
[:escapeany, node.value[:escape_html], [:dynamic, result]]
|
105
103
|
end
|
106
104
|
|
107
105
|
def find_and_preserve(code)
|
data/lib/haml/engine.rb
CHANGED
@@ -4,8 +4,9 @@ require 'haml/parser'
|
|
4
4
|
require 'haml/compiler'
|
5
5
|
require 'haml/html'
|
6
6
|
require 'haml/string_splitter'
|
7
|
-
require 'haml/
|
8
|
-
require 'haml/
|
7
|
+
require 'haml/escape'
|
8
|
+
require 'haml/escape_any'
|
9
|
+
require 'haml/force_escape'
|
9
10
|
require 'haml/dynamic_merger'
|
10
11
|
require 'haml/ambles'
|
11
12
|
require 'haml/whitespace'
|
@@ -32,8 +33,9 @@ module Haml
|
|
32
33
|
use HTML
|
33
34
|
use StringSplitter
|
34
35
|
filter :StaticAnalyzer
|
35
|
-
use
|
36
|
-
use
|
36
|
+
use Escape
|
37
|
+
use EscapeAny
|
38
|
+
use ForceEscape
|
37
39
|
filter :ControlFlow
|
38
40
|
use Ambles
|
39
41
|
filter :MultiFlattener
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'haml/escape'
|
3
|
+
|
4
|
+
module Haml
|
5
|
+
# This module allows Temple::Filter to dispatch :fescape on `#compile`.
|
6
|
+
module EscapeanyDispathcer
|
7
|
+
def on_escapeany(flag, exp)
|
8
|
+
[:escapeany, flag, compile(exp)]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
::Temple::Filter.include EscapeanyDispathcer
|
12
|
+
|
13
|
+
# Unlike Haml::Escape, this calls to_s when not escaped.
|
14
|
+
class EscapeAny < Escape
|
15
|
+
alias_method :on_escapeany, :on_escape
|
16
|
+
|
17
|
+
def on_dynamic(value)
|
18
|
+
[:dynamic, @escape ? @escape_code % value : "(#{value}).to_s"]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'haml/
|
2
|
+
require 'haml/escape'
|
3
3
|
|
4
4
|
module Haml
|
5
5
|
# This module allows Temple::Filter to dispatch :fescape on `#compile`.
|
@@ -10,8 +10,8 @@ module Haml
|
|
10
10
|
end
|
11
11
|
::Temple::Filter.include FescapeDispathcer
|
12
12
|
|
13
|
-
# Unlike Haml::
|
14
|
-
class
|
13
|
+
# Unlike Haml::Escape, this escapes value even if it's html_safe.
|
14
|
+
class ForceEscape < Escape
|
15
15
|
def initialize(opts = {})
|
16
16
|
super
|
17
17
|
@escape_code = options[:escape_code] || "::Haml::Util.escape_html((%s))"
|
@@ -20,8 +20,8 @@ module Haml
|
|
20
20
|
|
21
21
|
alias_method :on_fescape, :on_escape
|
22
22
|
|
23
|
-
#
|
24
|
-
# This method is not used if it's inserted after Haml::
|
23
|
+
# ForceEscape doesn't touch :escape expression.
|
24
|
+
# This method is not used if it's inserted after Haml::Escape.
|
25
25
|
def on_escape(flag, exp)
|
26
26
|
[:escape, flag, compile(exp)]
|
27
27
|
end
|
data/lib/haml/rails_template.rb
CHANGED
data/lib/haml/util.rb
CHANGED
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.
|
4
|
+
version: 6.1.1
|
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-
|
15
|
+
date: 2022-12-10 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
@@ -300,7 +300,8 @@ files:
|
|
300
300
|
- lib/haml/dynamic_merger.rb
|
301
301
|
- lib/haml/engine.rb
|
302
302
|
- lib/haml/error.rb
|
303
|
-
- lib/haml/
|
303
|
+
- lib/haml/escape.rb
|
304
|
+
- lib/haml/escape_any.rb
|
304
305
|
- lib/haml/filters.rb
|
305
306
|
- lib/haml/filters/base.rb
|
306
307
|
- lib/haml/filters/cdata.rb
|
@@ -318,7 +319,7 @@ files:
|
|
318
319
|
- lib/haml/filters/scss.rb
|
319
320
|
- lib/haml/filters/text_base.rb
|
320
321
|
- lib/haml/filters/tilt_base.rb
|
321
|
-
- lib/haml/
|
322
|
+
- lib/haml/force_escape.rb
|
322
323
|
- lib/haml/helpers.rb
|
323
324
|
- lib/haml/html.rb
|
324
325
|
- lib/haml/identity.rb
|