haml 6.3.0 → 7.0.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: b8754d03da194f9c74e620887cbc29d3aa95d93651129ca33aa60dc72be08dd1
4
- data.tar.gz: f4d26ea914200ac345926641d0d0d8ba36fb4b62a47600f63015d5c2d1dc8a11
3
+ metadata.gz: 2b10bef5fb4fb8621296fd6756746b6981a736d1b2a6adb356109c95fa37f047
4
+ data.tar.gz: 5925fcc2f3f7029cfcd81e82399c5a103e494ef9dcf808a5d6c8f414552bced4
5
5
  SHA512:
6
- metadata.gz: eccf9fb6676267281b3c918425e93f07e8771c2f41e8481a08f327cb2ddbd5b53e07f3c9025f37c1abc977ad732d3b2f67d3023c4e1f356897bed03e3572ca20
7
- data.tar.gz: 5ecd4d17716d5b0b4be7b57ebcfd28457f1b803cd376e37d4bcece2f30632e4e46d988eba1048e0c303a3599db5049b464e31854dda7f538bfe30565169769e9
6
+ metadata.gz: d7c7c493fbcaf1f98458b0d7cf3f2a1d196d1d9d568b034151c1fe4e711ba532edd20cb8cf8c69e00a12e5b7bdb7427c55849ae80cfff2039ed7001d20f071f6
7
+ data.tar.gz: 9b86bd8074d90eaec2e7ed7a7317da23d4a7a83ddeca7861d1a93e16be637d69cacb49f2ab833596328cfeb7708b624af977f8caa28c035ffdca6f75701a0ee3
@@ -0,0 +1,46 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ push:
13
+ if: github.repository_owner == 'haml'
14
+ runs-on: ubuntu-latest
15
+
16
+ environment:
17
+ name: rubygems.org
18
+ url: https://rubygems.org/gems/haml
19
+
20
+ permissions:
21
+ contents: write
22
+ id-token: write
23
+
24
+ steps:
25
+ - name: Harden Runner
26
+ uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
27
+ with:
28
+ egress-policy: audit
29
+
30
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
31
+
32
+ - name: Set up Ruby
33
+ uses: ruby/setup-ruby@eaecf785f6a34567a6d97f686bbb7bccc1ac1e5c # v1.237.0
34
+ with:
35
+ bundler-cache: true
36
+ ruby-version: ruby
37
+
38
+ - name: Publish to RubyGems
39
+ uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1
40
+
41
+ - name: Create GitHub release
42
+ run: |
43
+ tag_name="$(git describe --tags --abbrev=0)"
44
+ gh release create "${tag_name}" --verify-tag --generate-notes
45
+ env:
46
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -17,16 +17,14 @@ 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'
21
+ - '3.3'
22
+ - '3.4'
23
+ - ruby-head
26
24
  - jruby
27
- - truffleruby-head
25
+ - truffleruby
28
26
  steps:
29
- - uses: actions/checkout@v3
27
+ - uses: actions/checkout@v4
30
28
  - run: sudo apt-get update && sudo apt-get install -y nodejs libxslt-dev # nodejs for execjs, libxslt for TruffleRuby nokogiri
31
29
  - name: Set up Ruby
32
30
  uses: ruby/setup-ruby@v1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Haml Changelog
2
2
 
3
+ ## 7.0.1
4
+
5
+ * Use `Regexp#match?` predicate where possible https://github.com/haml/haml/pull/1194
6
+ * Fix the 'Changelog' link on rubygems.org/gems/haml https://github.com/haml/haml/pull/1192
7
+
8
+ ## 7.0.0
9
+
10
+ * Change the default `attr_quote` from `'` to `"` https://github.com/haml/haml/issues/1188
11
+ * Bump required Ruby version to 3.2 https://github.com/haml/haml/issues/1176
12
+
13
+ ## 6.4.0
14
+
15
+ * Authorize characters in attribute name for vuejs https://github.com/haml/haml/pull/1172
16
+ * Compile new-style attributes statically https://github.com/haml/haml/pull/1165
17
+ * Remove newlines from template annotation comments https://github.com/haml/haml/pull/1186
18
+ * Fix line numbers within a :ruby filter https://github.com/haml/haml/pull/1166
19
+ * Fix .class + nested class array bug https://github.com/haml/haml/pull/1191
20
+
21
+ ## 6.3.1
22
+
23
+ * Optimize string transformation using `String#tr` https://github.com/haml/haml/pull/1168
24
+ * Provide a Changelog link on rubygems.org https://github.com/haml/haml/pull/1157
25
+
3
26
  ## 6.3.0
4
27
 
5
28
  * Remove `Haml::RailsTemplate#default_format` that was added in v6.1.3 for Turbo [#1152](https://github.com/haml/haml/issues/1152), [#1154](https://github.com/haml/haml/issues/1154) ([discussion](https://github.com/haml/haml/pull/1144#issuecomment-1755088572))
@@ -8,7 +31,6 @@
8
31
  ## 6.2.5
9
32
 
10
33
  * Deprecate `Haml::RailsTemplate#default_format` that was added in v6.1.3 for Turbo ([discussion](https://github.com/haml/haml/pull/1144#issuecomment-1755088572))
11
- * See [the reference](https://github.com/haml/haml/blob/v6.2.5/REFERENCE.md#turbo) for suggested alternatives.
12
34
 
13
35
  ## 6.2.4
14
36
 
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,7 +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
data/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  [![test](https://github.com/haml/haml/actions/workflows/test.yml/badge.svg)](https://github.com/haml/haml/actions/workflows/test.yml)
5
5
  [![Code Climate](https://codeclimate.com/github/haml/haml/badges/gpa.svg)](https://codeclimate.com/github/haml/haml)
6
6
  [![Inline docs](https://inch-ci.org/github/haml/haml.svg)](https://inch-ci.org/github/haml/haml)
7
+ [![Discord Server](https://dcbadge.limes.pink/api/server/https://discord.gg/G8dEAwvV2Y)](https://discord.gg/G8dEAwvV2Y)
7
8
 
8
9
  Haml is a templating engine for HTML. It's designed to make it both easier and
9
10
  more pleasant to write HTML documents, by eliminating redundancy, reflecting the
@@ -156,7 +157,7 @@ on a specific area:
156
157
  ruby -Itest test/helper_test.rb -n test_buffer_access
157
158
  ~~~
158
159
 
159
- 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+.
160
161
 
161
162
  ## Team
162
163
 
data/REFERENCE.md CHANGED
@@ -105,7 +105,7 @@ set :haml, { escape_html: false }
105
105
  ```
106
106
 
107
107
  Finally, you can also set them by passing an options hash to `Haml::Engine.new` or `Haml::Template.new`.
108
- For the complete list of available options, please see `Haml::Engine`.
108
+ For the complete list of available options, please see [`Haml::Engine`](https://github.com/haml/haml/blob/main/lib/haml/engine.rb).
109
109
 
110
110
  ## Plain Text
111
111
 
@@ -320,7 +320,7 @@ or using `true` and `false`:
320
320
  %input(selected=true)
321
321
 
322
322
  This feature works only for attributes that are included in
323
- [`Haml::AttributeBuilder::BOOLEAN_ATTRIBUTES`](https://github.com/haml/haml/blob/main/lib/haml/attribute_builder.rb#L5),
323
+ [`Haml::BOOLEAN_ATTRIBUTES`](https://github.com/haml/haml/blob/main/lib/haml/attribute_compiler.rb#L8),
324
324
  as well as `data-` and `aria-` attributes.
325
325
 
326
326
  %input{'data-hidden' => false}
@@ -360,13 +360,6 @@ will render as:
360
360
 
361
361
  <a data-author-id='123' data-category='7' href='/posts'>Posts By Author</a>
362
362
 
363
- Notice that the underscore in `author_id` was replaced with a hyphen. If you wish
364
- to suppress this behavior, you can set Haml's
365
- {Haml::Options#hyphenate_data_attrs `:hyphenate_data_attrs` option} to `false`,
366
- and the output will be rendered as:
367
-
368
- <a data-author_id='123' data-category='7' href='/posts'>Posts By Author</a>
369
-
370
363
  This expansion of hashes is recursive – any value of the child hash that is
371
364
  itself a hash will create an attribute for each entry, with the attribute name
372
365
  prefixed with all ancestor keys. For example:
@@ -568,7 +561,7 @@ prefix for both the id and class attributes. For example:
568
561
  # file: app/controllers/users_controller.rb
569
562
 
570
563
  def show
571
- @user = CrazyUser.find(15)
564
+ @user = FriendlyUser.find(15)
572
565
  end
573
566
 
574
567
  -# file: app/views/users/show.haml
@@ -579,7 +572,7 @@ prefix for both the id and class attributes. For example:
579
572
 
580
573
  is compiled to:
581
574
 
582
- <div class='greeting_crazy_user' id='greeting_crazy_user_15'>
575
+ <div class='greeting_friendly_user' id='greeting_friendly_user_15'>
583
576
  <bar class='fixnum' id='fixnum_581' />
584
577
  Hello!
585
578
  </div>
@@ -587,11 +580,11 @@ is compiled to:
587
580
  If you require that the class be something other than the underscored object's
588
581
  class, you can implement the `haml_object_ref` method on the object.
589
582
 
590
- # file: app/models/crazy_user.rb
583
+ # file: app/models/friendly_user.rb
591
584
 
592
- class CrazyUser < ActiveRecord::Base
585
+ class FriendlyUser < ActiveRecord::Base
593
586
  def haml_object_ref
594
- "a_crazy_user"
587
+ "a_friendly_user"
595
588
  end
596
589
  end
597
590
 
@@ -602,7 +595,7 @@ class, you can implement the `haml_object_ref` method on the object.
602
595
 
603
596
  is compiled to:
604
597
 
605
- <div class='a_crazy_user' id='a_crazy_user_15'>
598
+ <div class='a_friendly_user' id='a_friendly_user_15'>
606
599
  Hello!
607
600
  </div>
608
601
 
@@ -1298,7 +1291,7 @@ Blocks of literal text can be preserved using the [`:preserve` filter](#preserve
1298
1291
 
1299
1292
  ## Turbo
1300
1293
 
1301
- For people using Turbo-rails and Haml 6+ need to either:
1294
+ For people using Turbo-rails need to either:
1302
1295
  * follow the naming convention with the html format (ie. ensure any `.haml` files end `.html.haml`), or
1303
1296
  * add a monkey patch as follows:
1304
1297
 
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/haml.gemspec CHANGED
@@ -21,7 +21,9 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.metadata = { 'rubygems_mfa_required' => 'true' }
23
23
 
24
- spec.required_ruby_version = '>= 2.1.0'
24
+ spec.metadata["changelog_uri"] = spec.homepage + "/docs/yardoc/file.CHANGELOG.html"
25
+
26
+ spec.required_ruby_version = '>= 3.2.0'
25
27
 
26
28
  spec.add_dependency 'temple', '>= 0.8.2'
27
29
  spec.add_dependency 'thor'
@@ -31,7 +33,6 @@ Gem::Specification.new do |spec|
31
33
  spec.add_development_dependency 'bundler'
32
34
  spec.add_development_dependency 'coffee-script'
33
35
  spec.add_development_dependency 'erubi'
34
- spec.add_development_dependency 'haml', '>= 5'
35
36
  spec.add_development_dependency 'less'
36
37
  spec.add_development_dependency 'minitest-reporters', '~> 1.1'
37
38
  spec.add_development_dependency 'rails', '>= 4.0'
@@ -54,7 +54,7 @@ module Haml::AttributeBuilder
54
54
  when value.is_a?(String)
55
55
  classes += value.split(' ')
56
56
  when value.is_a?(Array)
57
- classes += value.select { |v| v }
57
+ classes += value.flatten.select { |v| v }
58
58
  when value
59
59
  classes << value.to_s
60
60
  end
@@ -105,7 +105,7 @@ module Haml::AttributeBuilder
105
105
  if k.nil?
106
106
  flattened[key] = v
107
107
  else
108
- flattened["#{key}-#{k.to_s.gsub(/_/, '-')}"] = v
108
+ flattened["#{key}-#{k.to_s.tr('_', '-')}"] = v
109
109
  end
110
110
  end
111
111
  else
@@ -98,7 +98,7 @@ module Haml
98
98
  def compile_boolean!(temple, key, values)
99
99
  exp = literal_for(values.last)
100
100
 
101
- if Temple::StaticAnalyzer.static?(exp)
101
+ if values.last.first == :static || Temple::StaticAnalyzer.static?(exp)
102
102
  value = eval(exp)
103
103
  case value
104
104
  when true then temple << [:html, :attr, key, @format == :xhtml ? [:static, key] : [:multi]]
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
  )
@@ -7,7 +7,7 @@ module Haml
7
7
  def compile(node)
8
8
  text = node.value[:text]
9
9
  text = text.rstrip unless ::Haml::Util.contains_interpolation?(text) # for compatibility
10
- [:multi, *compile_plain(text)]
10
+ [:multi, [:newline], *compile_plain(text)]
11
11
  end
12
12
 
13
13
  private
@@ -3,7 +3,7 @@ module Haml
3
3
  class Filters
4
4
  class Ruby < Base
5
5
  def compile(node)
6
- [:code, node.value[:text]]
6
+ [:multi, [:newline], [:code, node.value[:text]]]
7
7
  end
8
8
  end
9
9
  end
data/lib/haml/parser.rb CHANGED
@@ -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
@@ -749,7 +749,7 @@ module Haml
749
749
  end
750
750
 
751
751
  def parse_new_attribute(scanner)
752
- unless (name = scanner.scan(/[-:\w]+/))
752
+ unless (name = scanner.scan(/[-:@#\w\.]+/))
753
753
  return if scanner.scan(/\)/)
754
754
  return false
755
755
  end
@@ -40,8 +40,8 @@ module Haml
40
40
 
41
41
  if ActionView::Base.try(:annotate_rendered_view_with_filenames) && template.format == :html
42
42
  options = options.merge(
43
- preamble: "<!-- BEGIN #{template.short_identifier} -->\n",
44
- postamble: "<!-- END #{template.short_identifier} -->\n",
43
+ preamble: "<!-- BEGIN #{template.short_identifier} -->",
44
+ postamble: "<!-- END #{template.short_identifier} -->",
45
45
  )
46
46
  end
47
47
 
@@ -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
data/lib/haml/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Haml
3
- VERSION = '6.3.0'
3
+ VERSION = '7.0.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: 6.3.0
4
+ version: 7.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Natalie Weizenbaum
@@ -9,10 +9,9 @@ authors:
9
9
  - Norman Clarke
10
10
  - Akira Matsuda
11
11
  - Takashi Kokubun
12
- autorequire:
13
12
  bindir: exe
14
13
  cert_chain: []
15
- date: 2023-12-10 00:00:00.000000000 Z
14
+ date: 1980-01-02 00:00:00.000000000 Z
16
15
  dependencies:
17
16
  - !ruby/object:Gem::Dependency
18
17
  name: temple
@@ -112,20 +111,6 @@ dependencies:
112
111
  - - ">="
113
112
  - !ruby/object:Gem::Version
114
113
  version: '0'
115
- - !ruby/object:Gem::Dependency
116
- name: haml
117
- requirement: !ruby/object:Gem::Requirement
118
- requirements:
119
- - - ">="
120
- - !ruby/object:Gem::Version
121
- version: '5'
122
- type: :development
123
- prerelease: false
124
- version_requirements: !ruby/object:Gem::Requirement
125
- requirements:
126
- - - ">="
127
- - !ruby/object:Gem::Version
128
- version: '5'
129
114
  - !ruby/object:Gem::Dependency
130
115
  name: less
131
116
  requirement: !ruby/object:Gem::Requirement
@@ -248,6 +233,7 @@ extensions: []
248
233
  extra_rdoc_files: []
249
234
  files:
250
235
  - ".github/FUNDING.yml"
236
+ - ".github/workflows/release.yml"
251
237
  - ".github/workflows/test.yml"
252
238
  - ".gitignore"
253
239
  - ".yardopts"
@@ -322,7 +308,7 @@ licenses:
322
308
  - MIT
323
309
  metadata:
324
310
  rubygems_mfa_required: 'true'
325
- post_install_message:
311
+ changelog_uri: https://haml.info/docs/yardoc/file.CHANGELOG.html
326
312
  rdoc_options: []
327
313
  require_paths:
328
314
  - lib
@@ -330,15 +316,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
330
316
  requirements:
331
317
  - - ">="
332
318
  - !ruby/object:Gem::Version
333
- version: 2.1.0
319
+ version: 3.2.0
334
320
  required_rubygems_version: !ruby/object:Gem::Requirement
335
321
  requirements:
336
322
  - - ">="
337
323
  - !ruby/object:Gem::Version
338
324
  version: '0'
339
325
  requirements: []
340
- rubygems_version: 3.4.10
341
- signing_key:
326
+ rubygems_version: 3.6.7
342
327
  specification_version: 4
343
328
  summary: An elegant, structured (X)HTML/XML templating engine.
344
329
  test_files: []