haml 5.1.1 → 5.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -6
- data/CHANGELOG.md +8 -1
- data/Rakefile +1 -5
- data/lib/haml/attribute_parser.rb +1 -1
- data/lib/haml/compiler.rb +19 -21
- data/lib/haml/error.rb +24 -24
- data/lib/haml/exec.rb +1 -1
- data/lib/haml/helpers.rb +1 -1
- data/lib/haml/options.rb +27 -35
- data/lib/haml/parser.rb +4 -4
- data/lib/haml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ab71634acdfecb8525662d862961b21f26d77f32adf34457443b96aa5118b8d
|
4
|
+
data.tar.gz: 3eae0d107f253137df0583ead35dfee0d7840d3de616db50e0dbbd5734acbe27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb8005b129e6874259a4ff900579a13cbc42c3f64b13640856a219c9f69fbd2cfc77d8126231148c2ebc6b58883e8687a4f447603fd6cdfc41195bf08e1127c3
|
7
|
+
data.tar.gz: 813db45e219554933892a41e023419e9a1a0e10602ebdf525f7efc1f14fe6f2afa4ff96ac691a0d8552989016453e7ce553864fc778447e1f55725de43b53406
|
data/.travis.yml
CHANGED
@@ -68,10 +68,6 @@ matrix:
|
|
68
68
|
gemfile: test/gemfiles/Gemfile.rails-4.1.x
|
69
69
|
- rvm: 2.6.3
|
70
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
71
|
- rvm: ruby-head
|
76
72
|
gemfile: test/gemfiles/Gemfile.rails-4.0.x
|
77
73
|
- rvm: ruby-head
|
@@ -94,6 +90,8 @@ matrix:
|
|
94
90
|
- rvm: jruby-9.2.7.0
|
95
91
|
gemfile: test/gemfiles/Gemfile.rails-5.0.x.erubi
|
96
92
|
fast_finish: true
|
97
|
-
before_install:
|
98
|
-
|
93
|
+
before_install:
|
94
|
+
- gem i rubygems-update -v '<3' && update_rubygems # https://github.com/travis-ci/travis-ci/issues/8974
|
95
|
+
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
96
|
+
- gem i bundler -v '<2'
|
99
97
|
script: "bundle exec rake submodules test"
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,18 @@
|
|
1
1
|
# Haml Changelog
|
2
2
|
|
3
|
+
## 5.1.2
|
4
|
+
|
5
|
+
Released on August 6, 2019
|
6
|
+
([diff](https://github.com/haml/haml/compare/v5.1.1...v5.1.2)).
|
7
|
+
|
8
|
+
* Fix crash in some environments such as New Relic by unfreezing string literals for ParseNode#inspect. [#1016](https://github.com/haml/haml/pull/1016) (thanks [Jalyna](https://github.com/jalyna))
|
9
|
+
|
3
10
|
## 5.1.1
|
4
11
|
|
5
12
|
Released on May 25, 2019
|
6
13
|
([diff](https://github.com/haml/haml/compare/v5.1.0...v5.1.1)).
|
7
14
|
|
8
|
-
* Fix NameError bug
|
15
|
+
* Fix NameError bug that happens on ruby 2.6.1-2.6.3 + haml 5.1.0 + rails < 5.1 + erubi. (Akira Matsuda)
|
9
16
|
|
10
17
|
## 5.1.0
|
11
18
|
|
data/Rakefile
CHANGED
@@ -88,11 +88,7 @@ task :profile do
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def gemfiles
|
91
|
-
@gemfiles ||=
|
92
|
-
Dir[File.dirname(__FILE__) + '/test/gemfiles/Gemfile.*'].
|
93
|
-
reject {|f| f =~ /\.lock$/}.
|
94
|
-
reject {|f| RUBY_VERSION < '1.9.3' && f =~ /Gemfile.rails-(\d+).\d+.x/ && $1.to_i > 3}
|
95
|
-
end
|
91
|
+
@gemfiles ||= Dir[File.dirname(__FILE__) + '/test/gemfiles/Gemfile.*'].reject {|f| f =~ /\.lock$/}
|
96
92
|
end
|
97
93
|
|
98
94
|
def with_each_gemfile
|
data/lib/haml/compiler.rb
CHANGED
@@ -188,30 +188,28 @@ module Haml
|
|
188
188
|
|
189
189
|
if @options.html5?
|
190
190
|
'<!DOCTYPE html>'
|
191
|
-
|
192
|
-
if @
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
else
|
198
|
-
case @node.value[:type]
|
199
|
-
when "strict"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
|
200
|
-
when "frameset"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">'
|
201
|
-
when "mobile"; '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'
|
202
|
-
when "rdfa"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">'
|
203
|
-
when "basic"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">'
|
204
|
-
else '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
elsif @options.html4?
|
191
|
+
elsif @options.xhtml?
|
192
|
+
if @node.value[:version] == "1.1"
|
193
|
+
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'
|
194
|
+
elsif @node.value[:version] == "5"
|
195
|
+
'<!DOCTYPE html>'
|
196
|
+
else
|
209
197
|
case @node.value[:type]
|
210
|
-
when "strict"; '<!DOCTYPE html PUBLIC "-//W3C//DTD
|
211
|
-
when "frameset"; '<!DOCTYPE html PUBLIC "-//W3C//DTD
|
212
|
-
|
198
|
+
when "strict"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
|
199
|
+
when "frameset"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">'
|
200
|
+
when "mobile"; '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'
|
201
|
+
when "rdfa"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">'
|
202
|
+
when "basic"; '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">'
|
203
|
+
else '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
|
213
204
|
end
|
214
205
|
end
|
206
|
+
|
207
|
+
elsif @options.html4?
|
208
|
+
case @node.value[:type]
|
209
|
+
when "strict"; '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'
|
210
|
+
when "frameset"; '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'
|
211
|
+
else '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'
|
212
|
+
end
|
215
213
|
end
|
216
214
|
end
|
217
215
|
|
data/lib/haml/error.rb
CHANGED
@@ -5,29 +5,29 @@ module Haml
|
|
5
5
|
class Error < StandardError
|
6
6
|
|
7
7
|
MESSAGES = {
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
8
|
+
bad_script_indent: '"%s" is indented at wrong level: expected %d, but was at %d.',
|
9
|
+
cant_run_filter: 'Can\'t run "%s" filter; you must require its dependencies first',
|
10
|
+
cant_use_tabs_and_spaces: "Indentation can't use both tabs and spaces.",
|
11
|
+
deeper_indenting: "The line was indented %d levels deeper than the previous line.",
|
12
|
+
filter_not_defined: 'Filter "%s" is not defined.',
|
13
|
+
gem_install_filter_deps: '"%s" filter\'s %s dependency missing: try installing it or adding it to your Gemfile',
|
14
|
+
illegal_element: "Illegal element: classes and ids must have values.",
|
15
|
+
illegal_nesting_content: "Illegal nesting: nesting within a tag that already has content is illegal.",
|
16
|
+
illegal_nesting_header: "Illegal nesting: nesting within a header command is illegal.",
|
17
|
+
illegal_nesting_line: "Illegal nesting: content can't be both given on the same line as %%%s and nested within it.",
|
18
|
+
illegal_nesting_plain: "Illegal nesting: nesting within plain text is illegal.",
|
19
|
+
illegal_nesting_self_closing: "Illegal nesting: nesting within a self-closing tag is illegal.",
|
20
|
+
inconsistent_indentation: "Inconsistent indentation: %s used for indentation, but the rest of the document was indented using %s.",
|
21
|
+
indenting_at_start: "Indenting at the beginning of the document is illegal.",
|
22
|
+
install_haml_contrib: 'To use the "%s" filter, please install the haml-contrib gem.',
|
23
|
+
invalid_attribute_list: 'Invalid attribute list: %s.',
|
24
|
+
invalid_filter_name: 'Invalid filter name ":%s".',
|
25
|
+
invalid_tag: 'Invalid tag: "%s".',
|
26
|
+
missing_if: 'Got "%s" with no preceding "if"',
|
27
|
+
no_ruby_code: "There's no Ruby code for %s to evaluate.",
|
28
|
+
self_closing_content: "Self-closing tags can't have content.",
|
29
|
+
unbalanced_brackets: 'Unbalanced brackets.',
|
30
|
+
no_end: <<-END
|
31
31
|
You don't need to use "- end" in Haml. Un-indent to close a block:
|
32
32
|
- if foo?
|
33
33
|
%strong Foo!
|
@@ -35,7 +35,7 @@ You don't need to use "- end" in Haml. Un-indent to close a block:
|
|
35
35
|
Not foo.
|
36
36
|
%p This line is un-indented, so it isn't part of the "if" block
|
37
37
|
END
|
38
|
-
}
|
38
|
+
}.freeze
|
39
39
|
|
40
40
|
def self.message(key, *args)
|
41
41
|
string = MESSAGES[key] or raise "[HAML BUG] No error messages for #{key}"
|
data/lib/haml/exec.rb
CHANGED
@@ -121,7 +121,7 @@ module Haml
|
|
121
121
|
@options[:input], @options[:output] = input, output
|
122
122
|
end
|
123
123
|
|
124
|
-
COLORS = {
|
124
|
+
COLORS = {red: 31, green: 32, yellow: 33}.freeze
|
125
125
|
|
126
126
|
# Prints a status message about performing the given action,
|
127
127
|
# colored using the given color (via terminal escapes) if possible.
|
data/lib/haml/helpers.rb
CHANGED
@@ -593,7 +593,7 @@ MESSAGE
|
|
593
593
|
end
|
594
594
|
|
595
595
|
# Characters that need to be escaped to HTML entities from user input
|
596
|
-
HTML_ESCAPE = {
|
596
|
+
HTML_ESCAPE = {'&' => '&', '<' => '<', '>' => '>', '"' => '"', "'" => '''}.freeze
|
597
597
|
|
598
598
|
HTML_ESCAPE_REGEX = /['"><&]/
|
599
599
|
|
data/lib/haml/options.rb
CHANGED
@@ -5,44 +5,40 @@ module Haml
|
|
5
5
|
# understands. Please see the {file:REFERENCE.md#options Haml Reference} to
|
6
6
|
# learn how to set the options.
|
7
7
|
class Options
|
8
|
-
|
9
8
|
@valid_formats = [:html4, :html5, :xhtml]
|
10
|
-
|
11
9
|
@buffer_option_keys = [:autoclose, :preserve, :attr_wrapper, :format,
|
12
10
|
:encoding, :escape_html, :escape_filter_interpolations, :escape_attrs, :hyphenate_data_attrs, :cdata]
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
class << self
|
13
|
+
# The default option values.
|
14
|
+
# @return Hash
|
15
|
+
def defaults
|
16
|
+
@defaults ||= Haml::TempleEngine.options.to_hash.merge(encoding: 'UTF-8')
|
17
|
+
end
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
@valid_formats
|
24
|
-
end
|
19
|
+
# An array of valid values for the `:format` option.
|
20
|
+
# @return Array
|
21
|
+
attr_reader :valid_formats
|
25
22
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
@buffer_option_keys
|
31
|
-
end
|
23
|
+
# An array of keys that will be used to provide a hash of options to
|
24
|
+
# {Haml::Buffer}.
|
25
|
+
# @return Hash
|
26
|
+
attr_reader :buffer_option_keys
|
32
27
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
28
|
+
# Returns a subset of defaults: those that {Haml::Buffer} cares about.
|
29
|
+
# @return [{Symbol => Object}] The options hash
|
30
|
+
def buffer_defaults
|
31
|
+
@buffer_defaults ||= buffer_option_keys.inject({}) do |hash, key|
|
32
|
+
hash.merge(key => defaults[key])
|
33
|
+
end
|
38
34
|
end
|
39
|
-
end
|
40
35
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
36
|
+
def wrap(options)
|
37
|
+
if options.is_a?(Options)
|
38
|
+
options
|
39
|
+
else
|
40
|
+
Options.new(options)
|
41
|
+
end
|
46
42
|
end
|
47
43
|
end
|
48
44
|
|
@@ -139,7 +135,7 @@ module Haml
|
|
139
135
|
# formatting errors.
|
140
136
|
#
|
141
137
|
# Defaults to `false`.
|
142
|
-
|
138
|
+
attr_accessor :remove_whitespace
|
143
139
|
|
144
140
|
# Whether or not attribute hashes and Ruby scripts designated by `=` or `~`
|
145
141
|
# should be evaluated. If this is `true`, said scripts are rendered as empty
|
@@ -175,7 +171,7 @@ module Haml
|
|
175
171
|
# Key is filter name in String and value is Class to use. Defaults to {}.
|
176
172
|
attr_accessor :filters
|
177
173
|
|
178
|
-
def initialize(values = {}
|
174
|
+
def initialize(values = {})
|
179
175
|
defaults.each {|k, v| instance_variable_set :"@#{k}", v}
|
180
176
|
values.each {|k, v| send("#{k}=", v) if defaults.has_key?(k) && !v.nil?}
|
181
177
|
yield if block_given?
|
@@ -245,10 +241,6 @@ module Haml
|
|
245
241
|
xhtml? || @cdata
|
246
242
|
end
|
247
243
|
|
248
|
-
def remove_whitespace=(value)
|
249
|
-
@remove_whitespace = value
|
250
|
-
end
|
251
|
-
|
252
244
|
def encoding=(value)
|
253
245
|
return unless value
|
254
246
|
@encoding = value.is_a?(Encoding) ? value.name : value.to_s
|
data/lib/haml/parser.rb
CHANGED
@@ -61,7 +61,7 @@ module Haml
|
|
61
61
|
SILENT_SCRIPT,
|
62
62
|
ESCAPE,
|
63
63
|
FILTER
|
64
|
-
]
|
64
|
+
].freeze
|
65
65
|
|
66
66
|
# The value of the character that designates that a line is part
|
67
67
|
# of a multiline string.
|
@@ -75,8 +75,8 @@ module Haml
|
|
75
75
|
#
|
76
76
|
BLOCK_WITH_SPACES = /do\s*\|\s*[^\|]*\s+\|\z/
|
77
77
|
|
78
|
-
MID_BLOCK_KEYWORDS = %w[else elsif rescue ensure end when]
|
79
|
-
START_BLOCK_KEYWORDS = %w[if begin case unless]
|
78
|
+
MID_BLOCK_KEYWORDS = %w[else elsif rescue ensure end when].freeze
|
79
|
+
START_BLOCK_KEYWORDS = %w[if begin case unless].freeze
|
80
80
|
# Try to parse assignments to block starters as best as possible
|
81
81
|
START_BLOCK_KEYWORD_REGEX = /(?:\w+(?:,\s*\w+)*\s*=\s*)?(#{START_BLOCK_KEYWORDS.join('|')})/
|
82
82
|
BLOCK_KEYWORD_REGEX = /^-?\s*(?:(#{MID_BLOCK_KEYWORDS.join('|')})|#{START_BLOCK_KEYWORD_REGEX.source})\b/
|
@@ -202,7 +202,7 @@ module Haml
|
|
202
202
|
end
|
203
203
|
|
204
204
|
def inspect
|
205
|
-
%Q[(#{type} #{value.inspect}#{children.each_with_object('') {|c, s| s << "\n#{c.inspect.gsub!(/^/, ' ')}"}})]
|
205
|
+
%Q[(#{type} #{value.inspect}#{children.each_with_object(''.dup) {|c, s| s << "\n#{c.inspect.gsub!(/^/, ' ')}"}})].dup
|
206
206
|
end
|
207
207
|
end
|
208
208
|
|
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: 5.1.
|
4
|
+
version: 5.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Natalie Weizenbaum
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2019-
|
14
|
+
date: 2019-08-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: temple
|