1
- if Gem ::Version . new ( Haml ::VERSION ) < Gem ::Version . new ( 5 )
1
+ haml_version = Gem ::Version . new ( Haml ::VERSION )
2
+
3
+ if haml_version < Gem ::Version . new ( 5 )
2
4
# Use module_eval so we crash when Haml::Helpers has not yet been loaded.
3
5
Haml ::Helpers . module_eval do
4
6
def html_escape_with_escaping_angular_expressions ( s )
@@ -8,8 +10,10 @@ def html_escape_with_escaping_angular_expressions(s)
8
10
alias_method :html_escape_without_escaping_angular_expressions , :html_escape
9
11
alias_method :html_escape , :html_escape_with_escaping_angular_expressions
10
12
end
11
- elsif Gem :: Version . new ( Haml :: VERSION ) < Gem ::Version . new ( 6 )
13
+ elsif haml_version < Gem ::Version . new ( '5.2' )
12
14
# Haml 5.0 and 5.1 fall back to erb
15
+ elsif haml_version < Gem ::Version . new ( 6 )
16
+ # HAML 5.2+
13
17
Haml ::Helpers . module_eval do
14
18
def html_escape_without_haml_xss_with_escaping_angular_expressions ( s )
15
19
html_escape_without_haml_xss_without_escaping_angular_expressions ( AngularXss ::Escaper . escape_if_unsafe ( s ) )
@@ -19,7 +23,8 @@ def html_escape_without_haml_xss_with_escaping_angular_expressions(s)
19
23
alias_method :html_escape_without_haml_xss , :html_escape_without_haml_xss_with_escaping_angular_expressions
20
24
end
21
25
else
22
- # Haml 6+ ditched most of is helpers. in favor of Haml::Util.escape_html
26
+ # Haml 6+
27
+ # It ditched most of is own helpers in favor of Haml::Util.escape_html
23
28
# https://github.com/haml/haml/blob/main/CHANGELOG.md#600
24
29
# https://github.com/haml/haml/compare/v5.2.2...v6.3.0
25
30
# https://github.com/haml/haml/blob/v6.3.0/lib/haml/util.rb
0 commit comments