haml 6.3.0 → 7.0.2
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 +4 -4
- data/.github/workflows/release.yml +46 -0
- data/.github/workflows/test.yml +5 -7
- data/CHANGELOG.md +28 -1
- data/Gemfile +4 -6
- data/README.md +2 -1
- data/REFERENCE.md +9 -16
- data/bin/console +3 -4
- data/bin/stackprof +2 -2
- data/haml.gemspec +4 -2
- data/lib/haml/attribute_builder.rb +2 -2
- data/lib/haml/attribute_compiler.rb +1 -1
- data/lib/haml/engine.rb +2 -2
- data/lib/haml/filters/plain.rb +1 -1
- data/lib/haml/filters/ruby.rb +1 -1
- data/lib/haml/parser.rb +10 -10
- data/lib/haml/rails_template.rb +2 -2
- data/lib/haml/string_splitter.rb +1 -1
- data/lib/haml/util.rb +2 -2
- data/lib/haml/version.rb +1 -1
- metadata +7 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 573c7656495ec01083743e533a972fa37d8daed53e617f9ea0e985d214bac0c4
|
|
4
|
+
data.tar.gz: 1bf75d7b14c90613961ae06be93c35a4cbf3fd41f1a4319042e30892695672c9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e9b8bb74ff5400deef4fa46fa9711a6952f61be3ffb4c1c53f4657f399ae5cc209473c792eab4501073465c86715249fabaf440201230084c3c311223a2f95c
|
|
7
|
+
data.tar.gz: 16ba05b091a7471ee379c970a136fdcaf167d9ee52356a2165e028f2d36b53b590c672899e5a0e3d083fceeeff908fcff0a767f0ce1096260ce8d36fb8b4c135
|
|
@@ -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 }}
|
data/.github/workflows/test.yml
CHANGED
|
@@ -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
|
|
25
|
+
- truffleruby
|
|
28
26
|
steps:
|
|
29
|
-
- uses: actions/checkout@
|
|
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,33 @@
|
|
|
1
1
|
# Haml Changelog
|
|
2
2
|
|
|
3
|
+
## 7.0.2
|
|
4
|
+
|
|
5
|
+
* Replace usages of `=~` with `.match?` where possible https://github.com/haml/haml/pull/1196
|
|
6
|
+
* Add source code URI to gemspec metadata https://github.com/haml/haml/pull/1197
|
|
7
|
+
|
|
8
|
+
## 7.0.1
|
|
9
|
+
|
|
10
|
+
* Use `Regexp#match?` predicate where possible https://github.com/haml/haml/pull/1194
|
|
11
|
+
* Fix the 'Changelog' link on rubygems.org/gems/haml https://github.com/haml/haml/pull/1192
|
|
12
|
+
|
|
13
|
+
## 7.0.0
|
|
14
|
+
|
|
15
|
+
* Change the default `attr_quote` from `'` to `"` https://github.com/haml/haml/issues/1188
|
|
16
|
+
* Bump required Ruby version to 3.2 https://github.com/haml/haml/issues/1176
|
|
17
|
+
|
|
18
|
+
## 6.4.0
|
|
19
|
+
|
|
20
|
+
* Authorize characters in attribute name for vuejs https://github.com/haml/haml/pull/1172
|
|
21
|
+
* Compile new-style attributes statically https://github.com/haml/haml/pull/1165
|
|
22
|
+
* Remove newlines from template annotation comments https://github.com/haml/haml/pull/1186
|
|
23
|
+
* Fix line numbers within a :ruby filter https://github.com/haml/haml/pull/1166
|
|
24
|
+
* Fix .class + nested class array bug https://github.com/haml/haml/pull/1191
|
|
25
|
+
|
|
26
|
+
## 6.3.1
|
|
27
|
+
|
|
28
|
+
* Optimize string transformation using `String#tr` https://github.com/haml/haml/pull/1168
|
|
29
|
+
* Provide a Changelog link on rubygems.org https://github.com/haml/haml/pull/1157
|
|
30
|
+
|
|
3
31
|
## 6.3.0
|
|
4
32
|
|
|
5
33
|
* 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 +36,6 @@
|
|
|
8
36
|
## 6.2.5
|
|
9
37
|
|
|
10
38
|
* 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
39
|
|
|
13
40
|
## 6.2.4
|
|
14
41
|
|
data/Gemfile
CHANGED
|
@@ -10,9 +10,11 @@ gemspec
|
|
|
10
10
|
|
|
11
11
|
gem 'benchmark-ips', '2.3.0'
|
|
12
12
|
gem 'maxitest'
|
|
13
|
-
gem '
|
|
13
|
+
gem 'base64'
|
|
14
|
+
gem 'bigdecimal'
|
|
15
|
+
gem 'mutex_m'
|
|
14
16
|
|
|
15
|
-
if /java
|
|
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
|
[](https://github.com/haml/haml/actions/workflows/test.yml)
|
|
5
5
|
[](https://codeclimate.com/github/haml/haml)
|
|
6
6
|
[](https://inch-ci.org/github/haml/haml)
|
|
7
|
+
[](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
|
|
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::
|
|
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 =
|
|
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='
|
|
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/
|
|
583
|
+
# file: app/models/friendly_user.rb
|
|
591
584
|
|
|
592
|
-
class
|
|
585
|
+
class FriendlyUser < ActiveRecord::Base
|
|
593
586
|
def haml_object_ref
|
|
594
|
-
"
|
|
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='
|
|
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
|
|
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 '
|
|
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
|
-
|
|
10
|
-
|
|
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 '
|
|
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
|
-
|
|
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,7 +21,10 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
|
|
22
22
|
spec.metadata = { 'rubygems_mfa_required' => 'true' }
|
|
23
23
|
|
|
24
|
-
spec.
|
|
24
|
+
spec.metadata["changelog_uri"] = spec.homepage + "/docs/yardoc/file.CHANGELOG.html"
|
|
25
|
+
spec.metadata["source_code_uri"] = "https://github.com/haml/haml"
|
|
26
|
+
|
|
27
|
+
spec.required_ruby_version = '>= 3.2.0'
|
|
25
28
|
|
|
26
29
|
spec.add_dependency 'temple', '>= 0.8.2'
|
|
27
30
|
spec.add_dependency 'thor'
|
|
@@ -31,7 +34,6 @@ Gem::Specification.new do |spec|
|
|
|
31
34
|
spec.add_development_dependency 'bundler'
|
|
32
35
|
spec.add_development_dependency 'coffee-script'
|
|
33
36
|
spec.add_development_dependency 'erubi'
|
|
34
|
-
spec.add_development_dependency 'haml', '>= 5'
|
|
35
37
|
spec.add_development_dependency 'less'
|
|
36
38
|
spec.add_development_dependency 'minitest-reporters', '~> 1.1'
|
|
37
39
|
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.
|
|
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
|
)
|
data/lib/haml/filters/plain.rb
CHANGED
data/lib/haml/filters/ruby.rb
CHANGED
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? &&
|
|
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
|
|
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
|
|
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? &&
|
|
633
|
+
if !attributes.empty? && /[.#](\.|#|\z)/.match?(attributes)
|
|
634
634
|
raise SyntaxError.new(Error.message(:illegal_element))
|
|
635
635
|
end
|
|
636
636
|
|
|
@@ -749,7 +749,7 @@ module Haml
|
|
|
749
749
|
end
|
|
750
750
|
|
|
751
751
|
def parse_new_attribute(scanner)
|
|
752
|
-
unless (name = scanner.scan(/[
|
|
752
|
+
unless (name = scanner.scan(/[-:@#\w\.]+/))
|
|
753
753
|
return if scanner.scan(/\)/)
|
|
754
754
|
return false
|
|
755
755
|
end
|
|
@@ -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] == ?: &&
|
|
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? &&
|
|
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
|
|
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]
|
|
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
|
-
|
|
874
|
+
(@indentation ? /^#{@indentation * (@template_tabs + 1)}/ : /^\s/).match?(@next_line.full)
|
|
875
875
|
end
|
|
876
876
|
|
|
877
877
|
def flat?
|
data/lib/haml/rails_template.rb
CHANGED
|
@@ -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}
|
|
44
|
-
postamble: "<!-- END #{template.short_identifier}
|
|
43
|
+
preamble: "<!-- BEGIN #{template.short_identifier} -->",
|
|
44
|
+
postamble: "<!-- END #{template.short_identifier} -->",
|
|
45
45
|
)
|
|
46
46
|
end
|
|
47
47
|
|
data/lib/haml/string_splitter.rb
CHANGED
|
@@ -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) &&
|
|
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
|
|
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
|
|
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
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:
|
|
4
|
+
version: 7.0.2
|
|
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:
|
|
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,8 @@ licenses:
|
|
|
322
308
|
- MIT
|
|
323
309
|
metadata:
|
|
324
310
|
rubygems_mfa_required: 'true'
|
|
325
|
-
|
|
311
|
+
changelog_uri: https://haml.info/docs/yardoc/file.CHANGELOG.html
|
|
312
|
+
source_code_uri: https://github.com/haml/haml
|
|
326
313
|
rdoc_options: []
|
|
327
314
|
require_paths:
|
|
328
315
|
- lib
|
|
@@ -330,15 +317,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
330
317
|
requirements:
|
|
331
318
|
- - ">="
|
|
332
319
|
- !ruby/object:Gem::Version
|
|
333
|
-
version: 2.
|
|
320
|
+
version: 3.2.0
|
|
334
321
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
335
322
|
requirements:
|
|
336
323
|
- - ">="
|
|
337
324
|
- !ruby/object:Gem::Version
|
|
338
325
|
version: '0'
|
|
339
326
|
requirements: []
|
|
340
|
-
rubygems_version: 3.
|
|
341
|
-
signing_key:
|
|
327
|
+
rubygems_version: 3.6.7
|
|
342
328
|
specification_version: 4
|
|
343
329
|
summary: An elegant, structured (X)HTML/XML templating engine.
|
|
344
330
|
test_files: []
|