haml 5.1.1 → 5.2.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/test.yml +36 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +32 -1
- data/Gemfile +1 -4
- data/README.md +21 -16
- data/REFERENCE.md +39 -10
- data/Rakefile +2 -13
- data/haml.gemspec +2 -1
- data/lib/haml/attribute_builder.rb +58 -3
- data/lib/haml/attribute_compiler.rb +45 -32
- data/lib/haml/attribute_parser.rb +1 -1
- data/lib/haml/buffer.rb +0 -56
- data/lib/haml/compiler.rb +19 -21
- data/lib/haml/error.rb +24 -24
- data/lib/haml/escapable.rb +38 -11
- data/lib/haml/exec.rb +1 -1
- data/lib/haml/helpers.rb +8 -2
- data/lib/haml/helpers/xss_mods.rb +6 -3
- data/lib/haml/options.rb +27 -35
- data/lib/haml/parser.rb +36 -8
- data/lib/haml/plugin.rb +18 -1
- data/lib/haml/railtie.rb +5 -0
- data/lib/haml/temple_engine.rb +2 -1
- data/lib/haml/util.rb +1 -1
- data/lib/haml/version.rb +1 -1
- metadata +22 -8
- data/.travis.yml +0 -99
data/lib/haml/plugin.rb
CHANGED
@@ -4,6 +4,11 @@ module Haml
|
|
4
4
|
|
5
5
|
# This module makes Haml work with Rails using the template handler API.
|
6
6
|
class Plugin
|
7
|
+
class << self
|
8
|
+
attr_accessor :annotate_rendered_view_with_filenames
|
9
|
+
end
|
10
|
+
self.annotate_rendered_view_with_filenames = false
|
11
|
+
|
7
12
|
def handles_encoding?; true; end
|
8
13
|
|
9
14
|
def compile(template, source)
|
@@ -14,9 +19,21 @@ module Haml
|
|
14
19
|
options[:mime_type] = template.mime_type
|
15
20
|
end
|
16
21
|
options[:filename] = template.identifier
|
22
|
+
|
23
|
+
preamble = '@output_buffer = output_buffer ||= ActionView::OutputBuffer.new if defined?(ActionView::OutputBuffer);'
|
24
|
+
postamble = ''
|
25
|
+
|
26
|
+
if self.class.annotate_rendered_view_with_filenames
|
27
|
+
# short_identifier is only available in Rails 6+. On older versions, 'inspect' gives similar results.
|
28
|
+
ident = template.respond_to?(:short_identifier) ? template.short_identifier : template.inspect
|
29
|
+
preamble += "haml_concat '<!-- BEGIN #{ident} -->'.html_safe;"
|
30
|
+
postamble += "haml_concat '<!-- END #{ident} -->'.html_safe;"
|
31
|
+
end
|
32
|
+
|
17
33
|
Haml::Engine.new(source, options).compiler.precompiled_with_ambles(
|
18
34
|
[],
|
19
|
-
after_preamble:
|
35
|
+
after_preamble: preamble,
|
36
|
+
before_postamble: postamble
|
20
37
|
)
|
21
38
|
end
|
22
39
|
|
data/lib/haml/railtie.rb
CHANGED
@@ -42,6 +42,11 @@ module Haml
|
|
42
42
|
Haml::Filters::RailsErb.template_class = Haml::SafeErubisTemplate
|
43
43
|
end
|
44
44
|
Haml::Template.options[:filters] = { 'erb' => Haml::Filters::RailsErb }
|
45
|
+
|
46
|
+
if app.config.respond_to?(:action_view) &&
|
47
|
+
app.config.action_view.annotate_rendered_view_with_filenames
|
48
|
+
Haml::Plugin.annotate_rendered_view_with_filenames = true
|
49
|
+
end
|
45
50
|
end
|
46
51
|
end
|
47
52
|
end
|
data/lib/haml/temple_engine.rb
CHANGED
@@ -65,7 +65,7 @@ module Haml
|
|
65
65
|
# (see {file:REFERENCE.md#encodings the `:encoding` option}).
|
66
66
|
#
|
67
67
|
# @return [String]
|
68
|
-
def precompiled_with_ambles(local_names, after_preamble: '')
|
68
|
+
def precompiled_with_ambles(local_names, after_preamble: '', before_postamble: '')
|
69
69
|
preamble = <<END.tr("\n", ';')
|
70
70
|
begin
|
71
71
|
extend Haml::Helpers
|
@@ -74,6 +74,7 @@ _erbout = _hamlout.buffer
|
|
74
74
|
#{after_preamble}
|
75
75
|
END
|
76
76
|
postamble = <<END.tr("\n", ';')
|
77
|
+
#{before_postamble}
|
77
78
|
#{precompiled_method_return_value}
|
78
79
|
ensure
|
79
80
|
@haml_buffer = @haml_buffer.upper if @haml_buffer
|
data/lib/haml/util.rb
CHANGED
@@ -213,7 +213,7 @@ MSG
|
|
213
213
|
scan.scan(/\w+/)
|
214
214
|
end
|
215
215
|
content = eval("\"#{interpolated}\"")
|
216
|
-
content
|
216
|
+
content = "#{char}#{content}" if char == '@' || char == '$'
|
217
217
|
content = "Haml::Helpers.html_escape((#{content}))" if escape_html
|
218
218
|
|
219
219
|
res << "\#{#{content}}"
|
data/lib/haml/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Natalie Weizenbaum
|
8
8
|
- Hampton Catlin
|
9
9
|
- Norman Clarke
|
10
10
|
- Akira Matsuda
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2021-07-27 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: temple
|
@@ -97,6 +97,20 @@ dependencies:
|
|
97
97
|
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
|
+
- !ruby/object:Gem::Dependency
|
101
|
+
name: simplecov
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
type: :development
|
108
|
+
prerelease: false
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
100
114
|
description: |
|
101
115
|
Haml (HTML Abstraction Markup Language) is a layer on top of HTML or XML that's
|
102
116
|
designed to express the structure of documents in a non-repetitive, elegant, and
|
@@ -111,9 +125,9 @@ executables:
|
|
111
125
|
extensions: []
|
112
126
|
extra_rdoc_files: []
|
113
127
|
files:
|
128
|
+
- ".github/workflows/test.yml"
|
114
129
|
- ".gitignore"
|
115
130
|
- ".gitmodules"
|
116
|
-
- ".travis.yml"
|
117
131
|
- ".yardopts"
|
118
132
|
- CHANGELOG.md
|
119
133
|
- FAQ.md
|
@@ -165,12 +179,12 @@ licenses:
|
|
165
179
|
- MIT
|
166
180
|
metadata:
|
167
181
|
bug_tracker_uri: https://github.com/haml/haml/issues
|
168
|
-
changelog_uri: https://github.com/haml/haml/blob/
|
182
|
+
changelog_uri: https://github.com/haml/haml/blob/main/CHANGELOG.md
|
169
183
|
documentation_uri: http://haml.info/docs.html
|
170
184
|
homepage_uri: http://haml.info
|
171
185
|
mailing_list_uri: https://groups.google.com/forum/?fromgroups#!forum/haml
|
172
186
|
source_code_uri: https://github.com/haml/haml
|
173
|
-
post_install_message:
|
187
|
+
post_install_message:
|
174
188
|
rdoc_options: []
|
175
189
|
require_paths:
|
176
190
|
- lib
|
@@ -185,8 +199,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
199
|
- !ruby/object:Gem::Version
|
186
200
|
version: '0'
|
187
201
|
requirements: []
|
188
|
-
rubygems_version: 3.
|
189
|
-
signing_key:
|
202
|
+
rubygems_version: 3.1.4
|
203
|
+
signing_key:
|
190
204
|
specification_version: 4
|
191
205
|
summary: An elegant, structured (X)HTML/XML templating engine.
|
192
206
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
dist: trusty
|
3
|
-
language: ruby
|
4
|
-
cache: bundler
|
5
|
-
rvm:
|
6
|
-
- ruby-head
|
7
|
-
- 2.6.3
|
8
|
-
- 2.5.5
|
9
|
-
- 2.4.6
|
10
|
-
- 2.3.8
|
11
|
-
- 2.2.10
|
12
|
-
- 2.1.10
|
13
|
-
- 2.0.0
|
14
|
-
- jruby-9.2.7.0
|
15
|
-
- rbx-3
|
16
|
-
gemfile:
|
17
|
-
- test/gemfiles/Gemfile.rails-6.0.x
|
18
|
-
- test/gemfiles/Gemfile.rails-5.2.x
|
19
|
-
- test/gemfiles/Gemfile.rails-5.1.x
|
20
|
-
- test/gemfiles/Gemfile.rails-5.0.x
|
21
|
-
- test/gemfiles/Gemfile.rails-5.0.x.erubi
|
22
|
-
- test/gemfiles/Gemfile.rails-4.2.x
|
23
|
-
- test/gemfiles/Gemfile.rails-4.1.x
|
24
|
-
- test/gemfiles/Gemfile.rails-4.0.x
|
25
|
-
matrix:
|
26
|
-
exclude:
|
27
|
-
- rvm: 2.0.0
|
28
|
-
gemfile: test/gemfiles/Gemfile.rails-6.0.x
|
29
|
-
- rvm: 2.1.10
|
30
|
-
gemfile: test/gemfiles/Gemfile.rails-6.0.x
|
31
|
-
- rvm: 2.2.10
|
32
|
-
gemfile: test/gemfiles/Gemfile.rails-6.0.x
|
33
|
-
- rvm: 2.3.8
|
34
|
-
gemfile: test/gemfiles/Gemfile.rails-6.0.x
|
35
|
-
- rvm: 2.4.6
|
36
|
-
gemfile: test/gemfiles/Gemfile.rails-6.0.x
|
37
|
-
- rvm: 2.0.0
|
38
|
-
gemfile: test/gemfiles/Gemfile.rails-5.2.x
|
39
|
-
- rvm: 2.1.10
|
40
|
-
gemfile: test/gemfiles/Gemfile.rails-5.2.x
|
41
|
-
- rvm: 2.0.0
|
42
|
-
gemfile: test/gemfiles/Gemfile.rails-5.1.x
|
43
|
-
- rvm: 2.1.10
|
44
|
-
gemfile: test/gemfiles/Gemfile.rails-5.1.x
|
45
|
-
- rvm: 2.0.0
|
46
|
-
gemfile: test/gemfiles/Gemfile.rails-5.0.x
|
47
|
-
- rvm: 2.0.0
|
48
|
-
gemfile: test/gemfiles/Gemfile.rails-5.0.x.erubi
|
49
|
-
- rvm: 2.1.10
|
50
|
-
gemfile: test/gemfiles/Gemfile.rails-5.0.x
|
51
|
-
- rvm: 2.1.10
|
52
|
-
gemfile: test/gemfiles/Gemfile.rails-5.0.x.erubi
|
53
|
-
- rvm: 2.4.6
|
54
|
-
gemfile: test/gemfiles/Gemfile.rails-4.0.x
|
55
|
-
- rvm: 2.4.6
|
56
|
-
gemfile: test/gemfiles/Gemfile.rails-4.1.x
|
57
|
-
- rvm: 2.4.6
|
58
|
-
gemfile: test/gemfiles/Gemfile.rails-4.2.x
|
59
|
-
- rvm: 2.5.5
|
60
|
-
gemfile: test/gemfiles/Gemfile.rails-4.0.x
|
61
|
-
- rvm: 2.5.5
|
62
|
-
gemfile: test/gemfiles/Gemfile.rails-4.1.x
|
63
|
-
- rvm: 2.5.5
|
64
|
-
gemfile: test/gemfiles/Gemfile.rails-4.2.x
|
65
|
-
- rvm: 2.6.3
|
66
|
-
gemfile: test/gemfiles/Gemfile.rails-4.0.x
|
67
|
-
- rvm: 2.6.3
|
68
|
-
gemfile: test/gemfiles/Gemfile.rails-4.1.x
|
69
|
-
- rvm: 2.6.3
|
70
|
-
gemfile: test/gemfiles/Gemfile.rails-4.2.x
|
71
|
-
- rvm: 2.6.3
|
72
|
-
gemfile: test/gemfiles/Gemfile.rails-5.0.x
|
73
|
-
- rvm: 2.6.3
|
74
|
-
gemfile: test/gemfiles/Gemfile.rails-5.0.x.erubi
|
75
|
-
- rvm: ruby-head
|
76
|
-
gemfile: test/gemfiles/Gemfile.rails-4.0.x
|
77
|
-
- rvm: ruby-head
|
78
|
-
gemfile: test/gemfiles/Gemfile.rails-4.1.x
|
79
|
-
- rvm: ruby-head
|
80
|
-
gemfile: test/gemfiles/Gemfile.rails-4.2.x
|
81
|
-
include:
|
82
|
-
- rvm: 2.6.3
|
83
|
-
gemfile: test/gemfiles/Gemfile.rails-edge
|
84
|
-
allow_failures:
|
85
|
-
- rvm: ruby-head
|
86
|
-
- rvm: rbx-3
|
87
|
-
- gemfile: test/gemfiles/Gemfile.rails-edge
|
88
|
-
- rvm: jruby-9.2.7.0
|
89
|
-
gemfile: test/gemfiles/Gemfile.rails-4.2.x
|
90
|
-
- rvm: jruby-9.2.7.0
|
91
|
-
gemfile: test/gemfiles/Gemfile.rails-4.1.x
|
92
|
-
- rvm: jruby-9.2.7.0
|
93
|
-
gemfile: test/gemfiles/Gemfile.rails-4.0.x
|
94
|
-
- rvm: jruby-9.2.7.0
|
95
|
-
gemfile: test/gemfiles/Gemfile.rails-5.0.x.erubi
|
96
|
-
fast_finish: true
|
97
|
-
before_install: gem i rubygems-update -v '<3' && update_rubygems # https://github.com/travis-ci/travis-ci/issues/8974
|
98
|
-
before_install: gem i bundler -v '<2'
|
99
|
-
script: "bundle exec rake submodules test"
|