haml 6.4.0 → 7.2.0

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: 313ffec5cc79d2b238173fde9769ac60d26b54bf15d3deda68adc84d0849620b
4
- data.tar.gz: 143e9115612a2555a4ce34c817745e330548a7eaedf98bc819ead44b2156f8ad
3
+ metadata.gz: 666a9c4513f3c1450ac36b92fefcff06d9a69aae9cc60840eb0182dbe53e2995
4
+ data.tar.gz: 709a5f0d8ad693be7bb7b2750d84fb1025d77ada780f045071e69bf16abfa76a
5
5
  SHA512:
6
- metadata.gz: 117f3811b514f8abd4142cdc8022e282e5a5434c5c0f6904e7eaff7655f58894e3486c999282f0140b6011016b52b139036071792c3ba33494de73342d512d77
7
- data.tar.gz: 99e76cc2438c8ba70aaf39b3ccc0df9b610e3ac06de35b8865c2f2ce5aa692f9642791b863602eef5e382d60224fdb44a143074c11f072ccad7556ae1461b261
6
+ metadata.gz: 5baeb23700d275b2a6c678b807756ff3536d638b782c4a26f44236fd3b9e9037d6b46c5c09b76b87e19f3cffaa668c5f221a395b8f2ba37a9a026c17ebc2fccc
7
+ data.tar.gz: cd428da5241f00f831080af924ef7fd2a066699c9805272727dbe32eb7672c90d6fbd1bbf6d3cae8dffc99f472d8dfb721b6558d78e64808b2a1319b7a78aa01
@@ -17,11 +17,6 @@ jobs:
17
17
  fail-fast: false
18
18
  matrix:
19
19
  ruby:
20
- - '2.5'
21
- - '2.6'
22
- - '2.7'
23
- - '3.0'
24
- - '3.1'
25
20
  - '3.2'
26
21
  - '3.3'
27
22
  - '3.4'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Haml Changelog
2
2
 
3
+ ## 7.2.0
4
+
5
+ * Do not require rails when haml is required https://github.com/haml/haml/pull/1201
6
+ * Point `changelog_uri` to GitHub Releases https://github.com/haml/haml/pull/1202
7
+
8
+ ## 7.1.0
9
+
10
+ * Support xhtml format for boolean nested data attributes https://github.com/haml/haml/pull/1200
11
+
12
+ ## 7.0.2
13
+
14
+ * Replace usages of `=~` with `.match?` where possible https://github.com/haml/haml/pull/1196
15
+ * Add source code URI to gemspec metadata https://github.com/haml/haml/pull/1197
16
+
17
+ ## 7.0.1
18
+
19
+ * Use `Regexp#match?` predicate where possible https://github.com/haml/haml/pull/1194
20
+ * Fix the 'Changelog' link on rubygems.org/gems/haml https://github.com/haml/haml/pull/1192
21
+
22
+ ## 7.0.0
23
+
24
+ * Change the default `attr_quote` from `'` to `"` https://github.com/haml/haml/issues/1188
25
+ * Bump required Ruby version to 3.2 https://github.com/haml/haml/issues/1176
26
+
3
27
  ## 6.4.0
4
28
 
5
29
  * Authorize characters in attribute name for vuejs https://github.com/haml/haml/pull/1172
data/Gemfile CHANGED
@@ -10,9 +10,11 @@ gemspec
10
10
 
11
11
  gem 'benchmark-ips', '2.3.0'
12
12
  gem 'maxitest'
13
- gem 'pry'
13
+ gem 'base64'
14
+ gem 'bigdecimal'
15
+ gem 'mutex_m'
14
16
 
15
- if /java/ === RUBY_PLATFORM # JRuby
17
+ if /java/.match?(RUBY_PLATFORM) # JRuby
16
18
  gem 'pandoc-ruby'
17
19
  else
18
20
  gem 'redcarpet'
@@ -21,14 +23,3 @@ else
21
23
  gem 'stackprof'
22
24
  end
23
25
  end
24
-
25
- if RUBY_VERSION < '2.6'
26
- gem 'rake-compiler', '< 1.2.4'
27
- end
28
-
29
- # Temporary workaround to ensure Ruby 2.5 and 2.6 can pass tests with Rails 6.1
30
- # Reference: https://github.com/rails/rails/issues/54260
31
- # TODO: Remove this workaround when dropping support for Rails versions below 7.1
32
- if RUBY_VERSION < '2.7'
33
- gem 'concurrent-ruby', '< 1.3.5'
34
- 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.0 and higher, so please make sure your changes run on 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/console CHANGED
@@ -1,11 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'bundler/setup'
4
- require 'hamlit'
4
+ require 'haml'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- require 'pry'
11
- Pry.start
9
+ require 'irb'
10
+ IRB.start
data/bin/stackprof CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'bundler/setup'
4
- require 'hamlit'
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
- Hamlit::Engine.new.call(haml)
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,9 +21,10 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.metadata = { 'rubygems_mfa_required' => 'true' }
23
23
 
24
- spec.metadata["changelog_uri"] = spec.homepage + "/blob/main/CHANGELOG.md"
24
+ spec.metadata["changelog_uri"] = "https://github.com/haml/haml/releases"
25
+ spec.metadata["source_code_uri"] = "https://github.com/haml/haml"
25
26
 
26
- spec.required_ruby_version = '>= 2.1.0'
27
+ spec.required_ruby_version = '>= 3.2.0'
27
28
 
28
29
  spec.add_dependency 'temple', '>= 0.8.2'
29
30
  spec.add_dependency 'thor'
@@ -33,7 +34,6 @@ Gem::Specification.new do |spec|
33
34
  spec.add_development_dependency 'bundler'
34
35
  spec.add_development_dependency 'coffee-script'
35
36
  spec.add_development_dependency 'erubi'
36
- spec.add_development_dependency 'haml', '>= 5'
37
37
  spec.add_development_dependency 'less'
38
38
  spec.add_development_dependency 'minitest-reporters', '~> 1.1'
39
39
  spec.add_development_dependency 'rails', '>= 4.0'
@@ -16,9 +16,9 @@ module Haml::AttributeBuilder
16
16
  when 'class'
17
17
  buf << " class=#{quote}#{build_class(escape_attrs, *hash[key])}#{quote}"
18
18
  when 'data'
19
- buf << build_data(escape_attrs, quote, *hash[key])
19
+ buf << build_data(escape_attrs, quote, format, *hash[key])
20
20
  when 'aria'
21
- buf << build_aria(escape_attrs, quote, *hash[key])
21
+ buf << build_aria(escape_attrs, quote, format, *hash[key])
22
22
  when *Haml::BOOLEAN_ATTRIBUTES, /\Adata-/, /\Aaria-/
23
23
  build_boolean!(escape_attrs, quote, format, buf, key, hash[key])
24
24
  else
@@ -62,17 +62,17 @@ module Haml::AttributeBuilder
62
62
  escape_html(escape_attrs, classes.map(&:to_s).uniq.join(' '))
63
63
  end
64
64
 
65
- def build_data(escape_attrs, quote, *hashes)
66
- build_data_attribute(:data, escape_attrs, quote, *hashes)
65
+ def build_data(escape_attrs, quote, format, *hashes)
66
+ build_data_attribute(:data, escape_attrs, quote, format, *hashes)
67
67
  end
68
68
 
69
- def build_aria(escape_attrs, quote, *hashes)
70
- build_data_attribute(:aria, escape_attrs, quote, *hashes)
69
+ def build_aria(escape_attrs, quote, format, *hashes)
70
+ build_data_attribute(:aria, escape_attrs, quote, format, *hashes)
71
71
  end
72
72
 
73
73
  private
74
74
 
75
- def build_data_attribute(key, escape_attrs, quote, *hashes)
75
+ def build_data_attribute(key, escape_attrs, quote, format, *hashes)
76
76
  attrs = []
77
77
  if hashes.size > 1 && hashes.all? { |h| h.is_a?(Hash) }
78
78
  data_value = merge_all_attrs(hashes)
@@ -84,7 +84,7 @@ module Haml::AttributeBuilder
84
84
  hash.sort_by(&:first).each do |key, value|
85
85
  case value
86
86
  when true
87
- attrs << " #{key}"
87
+ build_boolean!(escape_attrs, quote, format, attrs, key, value)
88
88
  when nil, false
89
89
  # noop
90
90
  else
@@ -85,7 +85,7 @@ module Haml
85
85
  end
86
86
 
87
87
  def compile_data!(temple, key, values)
88
- args = [@escape_attrs.inspect, "#{@quote.inspect}.freeze", values.map { |v| literal_for(v) }]
88
+ args = [@escape_attrs.inspect, "#{@quote.inspect}.freeze", @format.inspect, values.map { |v| literal_for(v) }]
89
89
  build_code = "::Haml::AttributeBuilder.build_#{key}(#{args.join(', ')})"
90
90
 
91
91
  if values.all? { |type, exp| type == :static || Temple::StaticAnalyzer.static?(exp) }
data/lib/haml/engine.rb CHANGED
@@ -17,13 +17,13 @@ module Haml
17
17
  :buffer_class,
18
18
  generator: Temple::Generators::StringBuffer,
19
19
  format: :html,
20
- attr_quote: "'",
20
+ attr_quote: '"',
21
21
  escape_html: true,
22
22
  escape_attrs: true,
23
23
  autoclose: %w(area base basefont br col command embed frame
24
24
  hr img input isindex keygen link menuitem meta
25
25
  param source track wbr),
26
- filename: "",
26
+ filename: '',
27
27
  disable_capture: false,
28
28
  remove_whitespace: false,
29
29
  )
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? && line.whitespace =~ /^#{@flat_spaces}/
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 value =~ /\A{.*}\z/m
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 name =~ /^\w+$/
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? && (attributes =~ /[.#](\.|#|\z)/)
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] == ?: && line.full =~ %r[^#{@line.full[/^\s+/]}\s])
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? && line.full !~ /^#{@flat_spaces}/
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 !~ BLOCK_WITH_SPACES
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] =~ /\W\?/) || 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
- @next_line.full =~ (@indentation ? /^#{@indentation * (@template_tabs + 1)}/ : /^\s/)
874
+ (@indentation ? /^#{@indentation * (@template_tabs + 1)}/ : /^\s/).match?(@next_line.full)
875
875
  end
876
876
 
877
877
  def flat?
@@ -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) && RUBY_VERSION >= "2.0.0" && Ripper.respond_to?(:lex)
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 str.encoding.name =~ /^UTF-(16|32)(BE|LE)?$/
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 name =~ /(en)?coding/in
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Haml
3
- VERSION = '6.4.0'
3
+ VERSION = '7.2.0'
4
4
  end
data/lib/haml.rb CHANGED
@@ -5,9 +5,5 @@ require 'haml/version'
5
5
  require 'haml/template'
6
6
 
7
7
  if File.basename($0) != 'haml'
8
- begin
9
- require 'rails'
10
- require 'haml/railtie'
11
- rescue LoadError
12
- end
8
+ require 'haml/railtie' if defined?(Rails::Railtie)
13
9
  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.4.0
4
+ version: 7.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Natalie Weizenbaum
@@ -111,20 +111,6 @@ dependencies:
111
111
  - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
- - !ruby/object:Gem::Dependency
115
- name: haml
116
- requirement: !ruby/object:Gem::Requirement
117
- requirements:
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- version: '5'
121
- type: :development
122
- prerelease: false
123
- version_requirements: !ruby/object:Gem::Requirement
124
- requirements:
125
- - - ">="
126
- - !ruby/object:Gem::Version
127
- version: '5'
128
114
  - !ruby/object:Gem::Dependency
129
115
  name: less
130
116
  requirement: !ruby/object:Gem::Requirement
@@ -322,7 +308,8 @@ licenses:
322
308
  - MIT
323
309
  metadata:
324
310
  rubygems_mfa_required: 'true'
325
- changelog_uri: https://haml.info/blob/main/CHANGELOG.md
311
+ changelog_uri: https://github.com/haml/haml/releases
312
+ source_code_uri: https://github.com/haml/haml
326
313
  rdoc_options: []
327
314
  require_paths:
328
315
  - lib
@@ -330,7 +317,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
330
317
  requirements:
331
318
  - - ">="
332
319
  - !ruby/object:Gem::Version
333
- version: 2.1.0
320
+ version: 3.2.0
334
321
  required_rubygems_version: !ruby/object:Gem::Requirement
335
322
  requirements:
336
323
  - - ">="