haml 7.0.0 → 7.0.2
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 +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile +1 -12
- data/README.md +1 -1
- data/bin/stackprof +2 -2
- data/haml.gemspec +2 -1
- data/lib/haml/parser.rb +9 -9
- data/lib/haml/string_splitter.rb +1 -1
- data/lib/haml/util.rb +2 -2
- data/lib/haml/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 573c7656495ec01083743e533a972fa37d8daed53e617f9ea0e985d214bac0c4
|
|
4
|
+
data.tar.gz: 1bf75d7b14c90613961ae06be93c35a4cbf3fd41f1a4319042e30892695672c9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e9b8bb74ff5400deef4fa46fa9711a6952f61be3ffb4c1c53f4657f399ae5cc209473c792eab4501073465c86715249fabaf440201230084c3c311223a2f95c
|
|
7
|
+
data.tar.gz: 16ba05b091a7471ee379c970a136fdcaf167d9ee52356a2165e028f2d36b53b590c672899e5a0e3d083fceeeff908fcff0a767f0ce1096260ce8d36fb8b4c135
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Haml Changelog
|
|
2
2
|
|
|
3
|
+
## 7.0.2
|
|
4
|
+
|
|
5
|
+
* Replace usages of `=~` with `.match?` where possible https://github.com/haml/haml/pull/1196
|
|
6
|
+
* Add source code URI to gemspec metadata https://github.com/haml/haml/pull/1197
|
|
7
|
+
|
|
8
|
+
## 7.0.1
|
|
9
|
+
|
|
10
|
+
* Use `Regexp#match?` predicate where possible https://github.com/haml/haml/pull/1194
|
|
11
|
+
* Fix the 'Changelog' link on rubygems.org/gems/haml https://github.com/haml/haml/pull/1192
|
|
12
|
+
|
|
3
13
|
## 7.0.0
|
|
4
14
|
|
|
5
15
|
* Change the default `attr_quote` from `'` to `"` https://github.com/haml/haml/issues/1188
|
data/Gemfile
CHANGED
|
@@ -14,7 +14,7 @@ gem 'base64'
|
|
|
14
14
|
gem 'bigdecimal'
|
|
15
15
|
gem 'mutex_m'
|
|
16
16
|
|
|
17
|
-
if /java
|
|
17
|
+
if /java/.match?(RUBY_PLATFORM) # JRuby
|
|
18
18
|
gem 'pandoc-ruby'
|
|
19
19
|
else
|
|
20
20
|
gem 'redcarpet'
|
|
@@ -23,14 +23,3 @@ else
|
|
|
23
23
|
gem 'stackprof'
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
|
-
|
|
27
|
-
if RUBY_VERSION < '2.6'
|
|
28
|
-
gem 'rake-compiler', '< 1.2.4'
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Temporary workaround to ensure Ruby 2.5 and 2.6 can pass tests with Rails 6.1
|
|
32
|
-
# Reference: https://github.com/rails/rails/issues/54260
|
|
33
|
-
# TODO: Remove this workaround when dropping support for Rails versions below 7.1
|
|
34
|
-
if RUBY_VERSION < '2.7'
|
|
35
|
-
gem 'concurrent-ruby', '< 1.3.5'
|
|
36
|
-
end
|
data/README.md
CHANGED
|
@@ -157,7 +157,7 @@ on a specific area:
|
|
|
157
157
|
ruby -Itest test/helper_test.rb -n test_buffer_access
|
|
158
158
|
~~~
|
|
159
159
|
|
|
160
|
-
Haml currently supports Ruby 2.0
|
|
160
|
+
Haml currently supports Ruby 3.2.0 and higher, so please make sure your changes run on 3.2+.
|
|
161
161
|
|
|
162
162
|
## Team
|
|
163
163
|
|
data/bin/stackprof
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
require 'bundler/setup'
|
|
4
|
-
require '
|
|
4
|
+
require 'haml'
|
|
5
5
|
require 'stackprof'
|
|
6
6
|
|
|
7
7
|
def open_flamegraph(report)
|
|
@@ -20,7 +20,7 @@ end
|
|
|
20
20
|
|
|
21
21
|
haml = File.read(ARGV.first)
|
|
22
22
|
StackProf.start(mode: :wall, interval: 1, raw: false)
|
|
23
|
-
|
|
23
|
+
Haml::Engine.new.call(haml)
|
|
24
24
|
StackProf.stop
|
|
25
25
|
|
|
26
26
|
report = StackProf::Report.new(StackProf.results)
|
data/haml.gemspec
CHANGED
|
@@ -21,7 +21,8 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
|
|
22
22
|
spec.metadata = { 'rubygems_mfa_required' => 'true' }
|
|
23
23
|
|
|
24
|
-
spec.metadata["changelog_uri"] = spec.homepage + "/
|
|
24
|
+
spec.metadata["changelog_uri"] = spec.homepage + "/docs/yardoc/file.CHANGELOG.html"
|
|
25
|
+
spec.metadata["source_code_uri"] = "https://github.com/haml/haml"
|
|
25
26
|
|
|
26
27
|
spec.required_ruby_version = '>= 3.2.0'
|
|
27
28
|
|
data/lib/haml/parser.rb
CHANGED
|
@@ -182,7 +182,7 @@ module Haml
|
|
|
182
182
|
|
|
183
183
|
tabs = line.whitespace.length / @indentation.length
|
|
184
184
|
return tabs if line.whitespace == @indentation * tabs
|
|
185
|
-
return @template_tabs + 1 if flat? &&
|
|
185
|
+
return @template_tabs + 1 if flat? && /^#{@flat_spaces}/.match?(line.whitespace)
|
|
186
186
|
|
|
187
187
|
message = Error.message(:inconsistent_indentation,
|
|
188
188
|
human_indentation(line.whitespace),
|
|
@@ -236,7 +236,7 @@ module Haml
|
|
|
236
236
|
DynamicAttributes = Struct.new(:new, :old) do
|
|
237
237
|
undef :old=
|
|
238
238
|
def old=(value)
|
|
239
|
-
unless
|
|
239
|
+
unless /\A{.*}\z/m.match?(value)
|
|
240
240
|
raise ArgumentError.new('Old attributes must start with "{" and end with "}"')
|
|
241
241
|
end
|
|
242
242
|
self[:old] = value
|
|
@@ -528,7 +528,7 @@ module Haml
|
|
|
528
528
|
end
|
|
529
529
|
|
|
530
530
|
def filter(name)
|
|
531
|
-
raise Error.new(Error.message(:invalid_filter_name, name)) unless
|
|
531
|
+
raise Error.new(Error.message(:invalid_filter_name, name)) unless /^\w+$/.match?(name)
|
|
532
532
|
|
|
533
533
|
if filter_opened?
|
|
534
534
|
@flat = true
|
|
@@ -630,7 +630,7 @@ module Haml
|
|
|
630
630
|
|
|
631
631
|
tag_name, attributes, rest = match
|
|
632
632
|
|
|
633
|
-
if !attributes.empty? &&
|
|
633
|
+
if !attributes.empty? && /[.#](\.|#|\z)/.match?(attributes)
|
|
634
634
|
raise SyntaxError.new(Error.message(:illegal_element))
|
|
635
635
|
end
|
|
636
636
|
|
|
@@ -786,7 +786,7 @@ module Haml
|
|
|
786
786
|
line_defined = instance_variable_defined?(:@line)
|
|
787
787
|
@line.tabs if line_defined
|
|
788
788
|
unless (flat? && !closes_flat?(line) && !closes_flat?(@line)) ||
|
|
789
|
-
(line_defined && @line.text[0] == ?: &&
|
|
789
|
+
(line_defined && @line.text[0] == ?: && %r[^#{@line.full[/^\s+/]}\s].match?(line.full))
|
|
790
790
|
return next_line if line.text.empty?
|
|
791
791
|
|
|
792
792
|
handle_multiline(line)
|
|
@@ -796,7 +796,7 @@ module Haml
|
|
|
796
796
|
end
|
|
797
797
|
|
|
798
798
|
def closes_flat?(line)
|
|
799
|
-
line && !line.text.empty? &&
|
|
799
|
+
line && !line.text.empty? && !(/^#{@flat_spaces}/.match?(line.full))
|
|
800
800
|
end
|
|
801
801
|
|
|
802
802
|
def handle_multiline(line)
|
|
@@ -814,7 +814,7 @@ module Haml
|
|
|
814
814
|
|
|
815
815
|
# Checks whether or not `line` is in a multiline sequence.
|
|
816
816
|
def is_multiline?(text)
|
|
817
|
-
text && text.length > 1 && text[-1] == MULTILINE_CHAR_VALUE && text[-2] == ?\s && text
|
|
817
|
+
text && text.length > 1 && text[-1] == MULTILINE_CHAR_VALUE && text[-2] == ?\s && !BLOCK_WITH_SPACES.match?(text)
|
|
818
818
|
end
|
|
819
819
|
|
|
820
820
|
def handle_ruby_multiline(line)
|
|
@@ -838,7 +838,7 @@ module Haml
|
|
|
838
838
|
# - and not "?\," which is a character literal
|
|
839
839
|
def is_ruby_multiline?(text)
|
|
840
840
|
text && text.length > 1 && text[-1] == ?, &&
|
|
841
|
-
!((text[-3, 2]
|
|
841
|
+
!(/\W\?/.match?(text[-3, 2]) || text[-3, 2] == "?\\")
|
|
842
842
|
end
|
|
843
843
|
|
|
844
844
|
def balance(*args)
|
|
@@ -871,7 +871,7 @@ module Haml
|
|
|
871
871
|
# Same semantics as block_opened?, except that block_opened? uses Line#tabs,
|
|
872
872
|
# which doesn't interact well with filter lines
|
|
873
873
|
def filter_opened?
|
|
874
|
-
|
|
874
|
+
(@indentation ? /^#{@indentation * (@template_tabs + 1)}/ : /^\s/).match?(@next_line.full)
|
|
875
875
|
end
|
|
876
876
|
|
|
877
877
|
def flat?
|
data/lib/haml/string_splitter.rb
CHANGED
|
@@ -7,7 +7,7 @@ end
|
|
|
7
7
|
module Haml
|
|
8
8
|
# Compile [:dynamic, "foo#{bar}"] to [:multi, [:static, 'foo'], [:dynamic, 'bar']]
|
|
9
9
|
class StringSplitter < Temple::Filter
|
|
10
|
-
if defined?(Ripper) &&
|
|
10
|
+
if defined?(Ripper) && Ripper.respond_to?(:lex)
|
|
11
11
|
class << self
|
|
12
12
|
# `code` param must be valid string literal
|
|
13
13
|
def compile(code)
|
data/lib/haml/util.rb
CHANGED
|
@@ -69,7 +69,7 @@ module Haml
|
|
|
69
69
|
# Shortcut for UTF-8 which might be the majority case
|
|
70
70
|
if str.encoding == Encoding::UTF_8
|
|
71
71
|
return str.gsub(/\A\uFEFF/, '')
|
|
72
|
-
elsif
|
|
72
|
+
elsif /^UTF-(16|32)(BE|LE)?$/.match?(str.encoding.name)
|
|
73
73
|
return str.gsub(Regexp.new("\\A\uFEFF".encode(str.encoding)), '')
|
|
74
74
|
else
|
|
75
75
|
return str
|
|
@@ -252,7 +252,7 @@ MSG
|
|
|
252
252
|
# From Ruby's parse.y
|
|
253
253
|
return unless scanner.scan(/([^\s'":;]+)\s*:\s*("(?:\\.|[^"])*"|[^"\s;]+?)[\s;]*-\*-/n)
|
|
254
254
|
name, val = scanner[1], scanner[2]
|
|
255
|
-
return unless
|
|
255
|
+
return unless /(en)?coding/in.match?(name)
|
|
256
256
|
val = $1 if val =~ /^"(.*)"$/n
|
|
257
257
|
return val
|
|
258
258
|
ensure
|
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: 7.0.
|
|
4
|
+
version: 7.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Natalie Weizenbaum
|
|
@@ -308,7 +308,8 @@ licenses:
|
|
|
308
308
|
- MIT
|
|
309
309
|
metadata:
|
|
310
310
|
rubygems_mfa_required: 'true'
|
|
311
|
-
changelog_uri: https://haml.info/
|
|
311
|
+
changelog_uri: https://haml.info/docs/yardoc/file.CHANGELOG.html
|
|
312
|
+
source_code_uri: https://github.com/haml/haml
|
|
312
313
|
rdoc_options: []
|
|
313
314
|
require_paths:
|
|
314
315
|
- lib
|