haml 7.0.1 → 7.1.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: 2b10bef5fb4fb8621296fd6756746b6981a736d1b2a6adb356109c95fa37f047
4
- data.tar.gz: 5925fcc2f3f7029cfcd81e82399c5a103e494ef9dcf808a5d6c8f414552bced4
3
+ metadata.gz: b5fd21b96511ffb6ab57ac08adcbb48f4fba26c9ba3998f9c320527e193b5d65
4
+ data.tar.gz: 42788bd91d1e0c66c8db3ab579f4005ccd176012207e300ee15244e079ea046c
5
5
  SHA512:
6
- metadata.gz: d7c7c493fbcaf1f98458b0d7cf3f2a1d196d1d9d568b034151c1fe4e711ba532edd20cb8cf8c69e00a12e5b7bdb7427c55849ae80cfff2039ed7001d20f071f6
7
- data.tar.gz: 9b86bd8074d90eaec2e7ed7a7317da23d4a7a83ddeca7861d1a93e16be637d69cacb49f2ab833596328cfeb7708b624af977f8caa28c035ffdca6f75701a0ee3
6
+ metadata.gz: 6a3959bebf8b2351923c7820d522aedc2bf104ac2d1d75cb76d7a8b2c5dbb4f6fb8b34434981534969658bc1f8068b768365a5a5a222f63dfe12376785462470
7
+ data.tar.gz: e5bb8177220ef5c56cbc2e34f3c0583b783604719ef1d666f707ee3dee95d2c73b0edd64654ff11776a57d63a9852ad6ee2f080e29431533a937d6dbea5d860c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Haml Changelog
2
2
 
3
+ ## 7.1.0
4
+
5
+ * Support xhtml format for boolean nested data attributes https://github.com/haml/haml/pull/1200
6
+
7
+ ## 7.0.2
8
+
9
+ * Replace usages of `=~` with `.match?` where possible https://github.com/haml/haml/pull/1196
10
+ * Add source code URI to gemspec metadata https://github.com/haml/haml/pull/1197
11
+
3
12
  ## 7.0.1
4
13
 
5
14
  * Use `Regexp#match?` predicate where possible https://github.com/haml/haml/pull/1194
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
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.metadata = { 'rubygems_mfa_required' => 'true' }
23
23
 
24
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
 
@@ -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/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),
@@ -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?
data/lib/haml/util.rb CHANGED
@@ -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 = '7.0.1'
3
+ VERSION = '7.1.0'
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: 7.0.1
4
+ version: 7.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Natalie Weizenbaum
@@ -309,6 +309,7 @@ licenses:
309
309
  metadata:
310
310
  rubygems_mfa_required: 'true'
311
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