haml 7.2.0 → 7.2.1

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: 666a9c4513f3c1450ac36b92fefcff06d9a69aae9cc60840eb0182dbe53e2995
4
- data.tar.gz: 709a5f0d8ad693be7bb7b2750d84fb1025d77ada780f045071e69bf16abfa76a
3
+ metadata.gz: f4665a2a3c561765d35c0eeec78fdc87d2574cd640249089ace5035cc672e46f
4
+ data.tar.gz: 02146e70c4ace1a58a1598ccfe25b08a22f06d0aa0554244806b1593cce85caa
5
5
  SHA512:
6
- metadata.gz: 5baeb23700d275b2a6c678b807756ff3536d638b782c4a26f44236fd3b9e9037d6b46c5c09b76b87e19f3cffaa668c5f221a395b8f2ba37a9a026c17ebc2fccc
7
- data.tar.gz: cd428da5241f00f831080af924ef7fd2a066699c9805272727dbe32eb7672c90d6fbd1bbf6d3cae8dffc99f472d8dfb721b6558d78e64808b2a1319b7a78aa01
6
+ metadata.gz: 3b24e11afe577f0b175fca4ae8fe5bdc45ae245e2f654a6d832ac2c619e25f2aeefb700e5ba51742f22ad5e849cc06d8831ef2a2c30083aab7a2bab727fcfe01
7
+ data.tar.gz: ad77cc1be2d2831de2cbac2568efbc368fb1627626c19138e7059b120fb2e85c88057b8f9fb705c22f82b7d910497018e156acbc61691ce52db4de5d39a0e764
@@ -20,6 +20,7 @@ jobs:
20
20
  - '3.2'
21
21
  - '3.3'
22
22
  - '3.4'
23
+ - '4.0'
23
24
  - ruby-head
24
25
  - jruby
25
26
  - truffleruby
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Haml Changelog
2
2
 
3
+ ## 7.2.1
4
+
5
+ * Do not rely on Ripper quirk in parsing old-style Haml attributes https://github.com/haml/haml/pull/1212
6
+
3
7
  ## 7.2.0
4
8
 
5
9
  * Do not require rails when haml is required https://github.com/haml/haml/pull/1201
data/Gemfile CHANGED
@@ -16,6 +16,7 @@ gem 'mutex_m'
16
16
 
17
17
  if /java/.match?(RUBY_PLATFORM) # JRuby
18
18
  gem 'pandoc-ruby'
19
+ gem 'rdoc', '< 8' # rdoc 8 depends on rbs, whose native extension doesn't build on JRuby
19
20
  else
20
21
  gem 'redcarpet'
21
22
 
data/lib/haml/parser.rb CHANGED
@@ -688,8 +688,17 @@ module Haml
688
688
  #
689
689
  # To scan such code correctly, this scans `a( hash, foo: bar }` instead, stops when there is
690
690
  # 1 more :on_embexpr_end (the last '}') than :on_embexpr_beg, and resurrects '{' afterwards.
691
- balanced, rest = balance_tokens(text.sub(?{, METHOD_CALL_PREFIX), :on_embexpr_beg, :on_embexpr_end, count: 1)
692
- attributes_hash = balanced.sub(METHOD_CALL_PREFIX, ?{)
691
+ #
692
+ # Old attributes allow invalid Hash constructs (e.g., `{ hash, foo: bar }`).
693
+ # Replacing the opening `{` with `a(` makes the syntax look like a method call so
694
+ # Ripper can lex it reliably.
695
+
696
+ attributes_hash, rest = balance_tokens(
697
+ text.sub(?{, METHOD_CALL_PREFIX),
698
+ [:on_lbrace, :on_tlambeg, :on_embexpr_beg],
699
+ [:on_rbrace, :on_embexpr_end],
700
+ count: 1)
701
+ attributes_hash = attributes_hash.sub(METHOD_CALL_PREFIX, ?{)
693
702
  rescue SyntaxError => e
694
703
  if e.message == Error.message(:unbalanced_brackets) && !@template.empty?
695
704
  text << "\n#{@next_line.text}"
@@ -850,10 +859,9 @@ module Haml
850
859
  text = ''.dup
851
860
  Ripper.lex(buf).each do |_, token, str|
852
861
  text << str
853
- case token
854
- when start
862
+ if start.include?(token)
855
863
  count += 1
856
- when finish
864
+ elsif finish.include?(token)
857
865
  count -= 1
858
866
  end
859
867
 
data/lib/haml/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Haml
3
- VERSION = '7.2.0'
3
+ VERSION = '7.2.1'
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.2.0
4
+ version: 7.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Natalie Weizenbaum