haml 6.3.0 → 7.0.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: b8754d03da194f9c74e620887cbc29d3aa95d93651129ca33aa60dc72be08dd1
4
- data.tar.gz: f4d26ea914200ac345926641d0d0d8ba36fb4b62a47600f63015d5c2d1dc8a11
3
+ metadata.gz: 0e24d15b93f8a8d9f856080c6fd6dbb2183b07602b2e3bd9beb43a718b4cd021
4
+ data.tar.gz: 5cc2496f9fdeba6950f152ffb0be8ea690f6543736d178e98da276da28706b4c
5
5
  SHA512:
6
- metadata.gz: eccf9fb6676267281b3c918425e93f07e8771c2f41e8481a08f327cb2ddbd5b53e07f3c9025f37c1abc977ad732d3b2f67d3023c4e1f356897bed03e3572ca20
7
- data.tar.gz: 5ecd4d17716d5b0b4be7b57ebcfd28457f1b803cd376e37d4bcece2f30632e4e46d988eba1048e0c303a3599db5049b464e31854dda7f538bfe30565169769e9
6
+ metadata.gz: 379fe2253bfe6688e41fdd16a8b007635ca3a48c688d5ba3e90ccafe4f8414959c1e800481a95fd76995615bd9af66977e74f0d4a08916ab1ff257bd7b375fbd
7
+ data.tar.gz: bdcecfe1f128e52e719d0005abddeb4a5fb4b049722c5db267bf1862ce54ddb69db18a7114a1e37b8db880676b513cbd8dc4d9fa02da23d5de66d4bbaa282338
@@ -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,23 @@
1
1
  # Haml Changelog
2
2
 
3
+ ## 7.0.0
4
+
5
+ * Change the default `attr_quote` from `'` to `"` https://github.com/haml/haml/issues/1188
6
+ * Bump required Ruby version to 3.2 https://github.com/haml/haml/issues/1176
7
+
8
+ ## 6.4.0
9
+
10
+ * Authorize characters in attribute name for vuejs https://github.com/haml/haml/pull/1172
11
+ * Compile new-style attributes statically https://github.com/haml/haml/pull/1165
12
+ * Remove newlines from template annotation comments https://github.com/haml/haml/pull/1186
13
+ * Fix line numbers within a :ruby filter https://github.com/haml/haml/pull/1166
14
+ * Fix .class + nested class array bug https://github.com/haml/haml/pull/1191
15
+
16
+ ## 6.3.1
17
+
18
+ * Optimize string transformation using `String#tr` https://github.com/haml/haml/pull/1168
19
+ * Provide a Changelog link on rubygems.org https://github.com/haml/haml/pull/1157
20
+
3
21
  ## 6.3.0
4
22
 
5
23
  * 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 +26,6 @@
8
26
  ## 6.2.5
9
27
 
10
28
  * 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
29
 
13
30
  ## 6.2.4
14
31
 
data/Gemfile CHANGED
@@ -10,7 +10,9 @@ 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
17
  if /java/ === RUBY_PLATFORM # JRuby
16
18
  gem 'pandoc-ruby'
@@ -25,3 +27,10 @@ end
25
27
  if RUBY_VERSION < '2.6'
26
28
  gem 'rake-compiler', '< 1.2.4'
27
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
@@ -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
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 + "/blob/main/CHANGELOG.md"
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
@@ -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
 
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.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: 6.3.0
4
+ version: 7.0.0
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/blob/main/CHANGELOG.md
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: []