haml 4.0.3 → 4.0.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of haml might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/REFERENCE.md +8 -1
- data/lib/haml.rb +1 -1
- data/lib/haml/helpers.rb +2 -4
- data/lib/haml/helpers/action_view_mods.rb +2 -2
- data/lib/haml/parser.rb +1 -2
- data/lib/haml/version.rb +1 -1
- data/test/engine_test.rb +14 -0
- data/test/helper_test.rb +20 -0
- data/test/results/partial_layout_erb.xhtml +1 -1
- data/test/templates/partial_layout_erb.erb +1 -1
- metadata +42 -43
- data/test/gemfiles/Gemfile.rails-3.2.x.lock +0 -98
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f98f3effc98f443e754cd0baeafe8e9ce7d7aee
|
4
|
+
data.tar.gz: 1e56de3d8a174339197799814a2a4d9bcdd968b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1795165acc4cd57c84e7c06184158f09b78a51c6e32c870366c90ab351e43d66f624b7928dd33238e17dcdfa8936bf14cdea0ff8a2e4462c5e4316111a052a92
|
7
|
+
data.tar.gz: 05f439cebe3f90c3f35aa418dd2064fea98884842ae6049761c54da10ce20da250768a300f8b0e3c29d91df84e349c1f1fac11dbebb2b0c86090146cda155956
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Haml Changelog
|
2
2
|
|
3
|
+
=======
|
4
|
+
|
5
|
+
## 4.0.4
|
6
|
+
|
7
|
+
Released on November 5, 2013 ([diff](https://github.com/haml/haml/compare/4.0.3...4.0.4)).
|
8
|
+
|
9
|
+
* Check for Rails::Railtie rather than Rails (thanks [Konstantin Shabanov](https://github.com/etehtsea)).
|
10
|
+
* Parser fix to allow literal '#' with suppress_eval (Matt Wildig).
|
11
|
+
* Helpers#escape_once works on frozen strings (as does
|
12
|
+
ERB::Util.html_escape_once for which it acts as a replacement in
|
13
|
+
Rails (thanks [Patrik Metzmacher](https://github.com/patrik)).
|
14
|
+
* Minor test fix (thanks [Mircea Moise](https://github.com/mmircea16)).
|
15
|
+
|
3
16
|
## 4.0.3
|
4
17
|
|
5
18
|
Released May 21, 2013 ([diff](https://github.com/haml/haml/compare/4.0.2...4.0.3)).
|
data/REFERENCE.md
CHANGED
@@ -622,6 +622,13 @@ is compiled to:
|
|
622
622
|
Hello!
|
623
623
|
</div>
|
624
624
|
|
625
|
+
The `:class` attribute may be used in conjunction with an object
|
626
|
+
reference. The compiled element will have the union of all classes.
|
627
|
+
|
628
|
+
- user = User.find(1)
|
629
|
+
%p[user]{:class => 'alpha bravo'}
|
630
|
+
<p id="user_1" class="alpha bravo user"></p>
|
631
|
+
|
625
632
|
## Doctype: `!!!`
|
626
633
|
|
627
634
|
When describing HTML documents with Haml, you can have a document type or XML
|
@@ -941,7 +948,7 @@ Ruby string interpolation. For example,
|
|
941
948
|
|
942
949
|
is the same as
|
943
950
|
|
944
|
-
%p= "This is
|
951
|
+
%p= "This is #{h quality} cake!"
|
945
952
|
|
946
953
|
and might compile to:
|
947
954
|
|
data/lib/haml.rb
CHANGED
data/lib/haml/helpers.rb
CHANGED
@@ -564,14 +564,12 @@ MESSAGE
|
|
564
564
|
# @return [String] The sanitized string
|
565
565
|
def escape_once(text)
|
566
566
|
text = text.to_s
|
567
|
-
text.gsub
|
568
|
-
text
|
567
|
+
text.gsub(HTML_ESCAPE_ONCE_REGEX, HTML_ESCAPE)
|
569
568
|
end
|
570
569
|
else
|
571
570
|
def escape_once(text)
|
572
571
|
text = text.to_s
|
573
|
-
text.gsub
|
574
|
-
text
|
572
|
+
text.gsub(HTML_ESCAPE_ONCE_REGEX){|s| HTML_ESCAPE[s]}
|
575
573
|
end
|
576
574
|
end
|
577
575
|
|
@@ -49,11 +49,11 @@ module ActionView
|
|
49
49
|
elsif value.is_a?(String)
|
50
50
|
value
|
51
51
|
else
|
52
|
-
|
52
|
+
nil
|
53
53
|
end
|
54
54
|
# NonCattingString is present in Rails less than 3.1.0. When support
|
55
55
|
# for 3.0 is dropped, this can be removed.
|
56
|
-
return ActionView::NonConcattingString.new(str) if defined?(ActionView::NonConcattingString)
|
56
|
+
return ActionView::NonConcattingString.new(str) if str && defined?(ActionView::NonConcattingString)
|
57
57
|
return str
|
58
58
|
else
|
59
59
|
capture_without_haml(*args, &block)
|
data/lib/haml/parser.rb
CHANGED
@@ -83,8 +83,7 @@ module Haml
|
|
83
83
|
DOCTYPE_REGEX = /(\d(?:\.\d)?)?[\s]*([a-z]*)\s*([^ ]+)?/i
|
84
84
|
|
85
85
|
# The Regex that matches a literal string or symbol value
|
86
|
-
LITERAL_VALUE_REGEX = /:(\w*)|(["'])((
|
87
|
-
|
86
|
+
LITERAL_VALUE_REGEX = /:(\w*)|(["'])((?!\\|\#{|\#@|\#\$|\2).|\\.)*\2/
|
88
87
|
|
89
88
|
def initialize(template, options)
|
90
89
|
# :eod is a special end-of-document marker
|
data/lib/haml/version.rb
CHANGED
data/test/engine_test.rb
CHANGED
@@ -1376,12 +1376,26 @@ HAML
|
|
1376
1376
|
assert_equal("<a b='a, b'></a>\n", render("%a{:b => 'a, b'}", :suppress_eval => true))
|
1377
1377
|
assert_equal("<a b='a\tb'></a>\n", render('%a{:b => "a\tb"}', :suppress_eval => true))
|
1378
1378
|
assert_equal("<a b='a\#{foo}b'></a>\n", render('%a{:b => "a\\#{foo}b"}', :suppress_eval => true))
|
1379
|
+
assert_equal("<a b='#f00'></a>\n", render("%a{:b => '#f00'}", :suppress_eval => true))
|
1379
1380
|
end
|
1380
1381
|
|
1381
1382
|
def test_dynamic_hashes_with_suppress_eval
|
1382
1383
|
assert_equal("<a></a>\n", render('%a{:b => "a #{1 + 1} b", :c => "d"}', :suppress_eval => true))
|
1383
1384
|
end
|
1384
1385
|
|
1386
|
+
def test_interpolates_instance_vars_in_attribute_values
|
1387
|
+
scope = Object.new
|
1388
|
+
scope.instance_variable_set :@foo, 'bar'
|
1389
|
+
assert_equal("<a b='a bar b'></a>\n", render('%a{:b => "a #@foo b"}', :scope => scope))
|
1390
|
+
end
|
1391
|
+
|
1392
|
+
def test_interpolates_global_vars_in_attribute_values
|
1393
|
+
# make sure the value isn't just interpolated in during template compilation
|
1394
|
+
engine = Haml::Engine.new('%a{:b => "a #$global_var_for_testing b"}')
|
1395
|
+
$global_var_for_testing = 'bar'
|
1396
|
+
assert_equal("<a b='a bar b'></a>\n", engine.to_html)
|
1397
|
+
end
|
1398
|
+
|
1385
1399
|
def test_utf8_attrs
|
1386
1400
|
assert_equal("<a href='héllo'></a>\n", render("%a{:href => 'héllo'}"))
|
1387
1401
|
assert_equal("<a href='héllo'></a>\n", render("%a(href='héllo')"))
|
data/test/helper_test.rb
CHANGED
@@ -403,6 +403,18 @@ HAML
|
|
403
403
|
assert_equal("foo\n", render("= capture { 'foo' }", :action_view))
|
404
404
|
end
|
405
405
|
|
406
|
+
def test_capture_with_non_string_value_reurns_nil
|
407
|
+
Haml::Helpers.module_eval do
|
408
|
+
def check_capture_returns_nil(&block)
|
409
|
+
contents = capture(&block)
|
410
|
+
|
411
|
+
contents << "ERROR" if contents
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
assert_equal("\n", render("= check_capture_returns_nil { 2 }", :action_view))
|
416
|
+
end
|
417
|
+
|
406
418
|
def test_find_and_preserve_with_block
|
407
419
|
assert_equal("<pre>Foo
Bar</pre>\nFoo\nBar\n",
|
408
420
|
render("= find_and_preserve do\n %pre\n Foo\n Bar\n Foo\n Bar"))
|
@@ -541,5 +553,13 @@ HAML
|
|
541
553
|
$stderr = old_stderr
|
542
554
|
end
|
543
555
|
|
556
|
+
def test_escape_once_should_work_on_frozen_strings
|
557
|
+
begin
|
558
|
+
Haml::Helpers.escape_once('foo'.freeze)
|
559
|
+
rescue => e
|
560
|
+
flunk e.message
|
561
|
+
end
|
562
|
+
end
|
563
|
+
|
544
564
|
end
|
545
565
|
|
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.0.
|
4
|
+
version: 4.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Weizenbaum
|
@@ -10,78 +10,78 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-05
|
13
|
+
date: 2013-11-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
+
type: :runtime
|
16
17
|
name: tilt
|
18
|
+
prerelease: false
|
17
19
|
requirement: !ruby/object:Gem::Requirement
|
18
20
|
requirements:
|
19
|
-
- -
|
21
|
+
- - ">="
|
20
22
|
- !ruby/object:Gem::Version
|
21
23
|
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '0'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
+
type: :development
|
30
31
|
name: rails
|
32
|
+
prerelease: false
|
31
33
|
requirement: !ruby/object:Gem::Requirement
|
32
34
|
requirements:
|
33
|
-
- -
|
35
|
+
- - ">="
|
34
36
|
- !ruby/object:Gem::Version
|
35
37
|
version: 3.0.0
|
36
|
-
type: :development
|
37
|
-
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 3.0.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
|
+
type: :development
|
44
45
|
name: rbench
|
46
|
+
prerelease: false
|
45
47
|
requirement: !ruby/object:Gem::Requirement
|
46
48
|
requirements:
|
47
|
-
- -
|
49
|
+
- - ">="
|
48
50
|
- !ruby/object:Gem::Version
|
49
51
|
version: '0'
|
50
|
-
type: :development
|
51
|
-
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
|
+
type: :development
|
58
59
|
name: minitest
|
60
|
+
prerelease: false
|
59
61
|
requirement: !ruby/object:Gem::Requirement
|
60
62
|
requirements:
|
61
|
-
- -
|
63
|
+
- - ">="
|
62
64
|
- !ruby/object:Gem::Version
|
63
65
|
version: '0'
|
64
|
-
type: :development
|
65
|
-
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
|
+
type: :development
|
72
73
|
name: nokogiri
|
74
|
+
prerelease: false
|
73
75
|
requirement: !ruby/object:Gem::Requirement
|
74
76
|
requirements:
|
75
|
-
- -
|
77
|
+
- - "~>"
|
76
78
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
78
|
-
type: :development
|
79
|
-
prerelease: false
|
79
|
+
version: 1.5.10
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
84
|
+
version: 1.5.10
|
85
85
|
description: |
|
86
86
|
Haml (HTML Abstraction Markup Language) is a layer on top of HTML or XML that's
|
87
87
|
designed to express the structure of documents in a non-repetitive, elegant, and
|
@@ -96,45 +96,47 @@ executables:
|
|
96
96
|
extensions: []
|
97
97
|
extra_rdoc_files: []
|
98
98
|
files:
|
99
|
+
- lib/haml.rb
|
99
100
|
- lib/haml/buffer.rb
|
100
101
|
- lib/haml/compiler.rb
|
101
102
|
- lib/haml/engine.rb
|
102
103
|
- lib/haml/error.rb
|
103
104
|
- lib/haml/exec.rb
|
104
105
|
- lib/haml/filters.rb
|
105
|
-
- lib/haml/helpers/action_view_extensions.rb
|
106
|
-
- lib/haml/helpers/action_view_mods.rb
|
107
|
-
- lib/haml/helpers/action_view_xss_mods.rb
|
108
|
-
- lib/haml/helpers/safe_erubis_template.rb
|
109
|
-
- lib/haml/helpers/xss_mods.rb
|
110
106
|
- lib/haml/helpers.rb
|
111
107
|
- lib/haml/options.rb
|
112
108
|
- lib/haml/parser.rb
|
113
109
|
- lib/haml/railtie.rb
|
114
110
|
- lib/haml/sass_rails_filter.rb
|
115
|
-
- lib/haml/template/options.rb
|
116
|
-
- lib/haml/template/plugin.rb
|
117
111
|
- lib/haml/template.rb
|
118
112
|
- lib/haml/util.rb
|
119
113
|
- lib/haml/version.rb
|
120
|
-
- lib/haml.rb
|
114
|
+
- lib/haml/helpers/action_view_extensions.rb
|
115
|
+
- lib/haml/helpers/action_view_mods.rb
|
116
|
+
- lib/haml/helpers/action_view_xss_mods.rb
|
117
|
+
- lib/haml/helpers/safe_erubis_template.rb
|
118
|
+
- lib/haml/helpers/xss_mods.rb
|
119
|
+
- lib/haml/template/options.rb
|
120
|
+
- lib/haml/template/plugin.rb
|
121
121
|
- bin/haml
|
122
122
|
- test/engine_test.rb
|
123
|
+
- test/filters_test.rb
|
124
|
+
- test/helper_test.rb
|
125
|
+
- test/parser_test.rb
|
126
|
+
- test/template_test.rb
|
127
|
+
- test/test_helper.rb
|
128
|
+
- test/util_test.rb
|
123
129
|
- test/erb/_av_partial_1.erb
|
124
130
|
- test/erb/_av_partial_2.erb
|
125
131
|
- test/erb/action_view.erb
|
126
132
|
- test/erb/standard.erb
|
127
|
-
- test/filters_test.rb
|
128
133
|
- test/gemfiles/Gemfile.rails-3.0.x
|
129
134
|
- test/gemfiles/Gemfile.rails-3.1.x
|
130
135
|
- test/gemfiles/Gemfile.rails-3.2.x
|
131
|
-
- test/gemfiles/Gemfile.rails-3.2.x.lock
|
132
136
|
- test/gemfiles/Gemfile.rails-4.0.x
|
133
137
|
- test/gemfiles/Gemfile.rails-4.0.x.lock
|
134
|
-
- test/helper_test.rb
|
135
138
|
- test/markaby/standard.mab
|
136
139
|
- test/mocks/article.rb
|
137
|
-
- test/parser_test.rb
|
138
140
|
- test/results/content_for_layout.xhtml
|
139
141
|
- test/results/eval_suppressed.xhtml
|
140
142
|
- test/results/helpers.xhtml
|
@@ -153,7 +155,6 @@ files:
|
|
153
155
|
- test/results/tag_parsing.xhtml
|
154
156
|
- test/results/very_basic.xhtml
|
155
157
|
- test/results/whitespace_handling.xhtml
|
156
|
-
- test/template_test.rb
|
157
158
|
- test/templates/_av_partial_1.haml
|
158
159
|
- test/templates/_av_partial_1_ugly.haml
|
159
160
|
- test/templates/_av_partial_2.haml
|
@@ -186,10 +187,8 @@ files:
|
|
186
187
|
- test/templates/tag_parsing.haml
|
187
188
|
- test/templates/very_basic.haml
|
188
189
|
- test/templates/whitespace_handling.haml
|
189
|
-
- test/test_helper.rb
|
190
|
-
- test/util_test.rb
|
191
190
|
- Rakefile
|
192
|
-
- .yardopts
|
191
|
+
- ".yardopts"
|
193
192
|
- CHANGELOG.md
|
194
193
|
- FAQ.md
|
195
194
|
- MIT-LICENSE
|
@@ -220,17 +219,17 @@ require_paths:
|
|
220
219
|
- lib
|
221
220
|
required_ruby_version: !ruby/object:Gem::Requirement
|
222
221
|
requirements:
|
223
|
-
- -
|
222
|
+
- - ">="
|
224
223
|
- !ruby/object:Gem::Version
|
225
224
|
version: '0'
|
226
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
226
|
requirements:
|
228
|
-
- -
|
227
|
+
- - ">="
|
229
228
|
- !ruby/object:Gem::Version
|
230
229
|
version: '0'
|
231
230
|
requirements: []
|
232
231
|
rubyforge_project:
|
233
|
-
rubygems_version: 2.
|
232
|
+
rubygems_version: 2.1.5
|
234
233
|
signing_key:
|
235
234
|
specification_version: 4
|
236
235
|
summary: An elegant, structured (X)HTML/XML templating engine.
|
@@ -1,98 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: /Users/norman/work/haml
|
3
|
-
specs:
|
4
|
-
haml (4.0.3)
|
5
|
-
tilt
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: http://rubygems.org/
|
9
|
-
specs:
|
10
|
-
actionmailer (3.2.13)
|
11
|
-
actionpack (= 3.2.13)
|
12
|
-
mail (~> 2.5.3)
|
13
|
-
actionpack (3.2.13)
|
14
|
-
activemodel (= 3.2.13)
|
15
|
-
activesupport (= 3.2.13)
|
16
|
-
builder (~> 3.0.0)
|
17
|
-
erubis (~> 2.7.0)
|
18
|
-
journey (~> 1.0.4)
|
19
|
-
rack (~> 1.4.5)
|
20
|
-
rack-cache (~> 1.2)
|
21
|
-
rack-test (~> 0.6.1)
|
22
|
-
sprockets (~> 2.2.1)
|
23
|
-
activemodel (3.2.13)
|
24
|
-
activesupport (= 3.2.13)
|
25
|
-
builder (~> 3.0.0)
|
26
|
-
activerecord (3.2.13)
|
27
|
-
activemodel (= 3.2.13)
|
28
|
-
activesupport (= 3.2.13)
|
29
|
-
arel (~> 3.0.2)
|
30
|
-
tzinfo (~> 0.3.29)
|
31
|
-
activeresource (3.2.13)
|
32
|
-
activemodel (= 3.2.13)
|
33
|
-
activesupport (= 3.2.13)
|
34
|
-
activesupport (3.2.13)
|
35
|
-
i18n (= 0.6.1)
|
36
|
-
multi_json (~> 1.0)
|
37
|
-
arel (3.0.2)
|
38
|
-
builder (3.0.4)
|
39
|
-
erubis (2.7.0)
|
40
|
-
hike (1.2.2)
|
41
|
-
i18n (0.6.1)
|
42
|
-
journey (1.0.4)
|
43
|
-
json (1.8.0)
|
44
|
-
mail (2.5.4)
|
45
|
-
mime-types (~> 1.16)
|
46
|
-
treetop (~> 1.4.8)
|
47
|
-
mime-types (1.23)
|
48
|
-
minitest (4.7.4)
|
49
|
-
multi_json (1.7.3)
|
50
|
-
nokogiri (1.5.9)
|
51
|
-
polyglot (0.3.3)
|
52
|
-
rack (1.4.5)
|
53
|
-
rack-cache (1.2)
|
54
|
-
rack (>= 0.4)
|
55
|
-
rack-ssl (1.3.3)
|
56
|
-
rack
|
57
|
-
rack-test (0.6.2)
|
58
|
-
rack (>= 1.0)
|
59
|
-
rails (3.2.13)
|
60
|
-
actionmailer (= 3.2.13)
|
61
|
-
actionpack (= 3.2.13)
|
62
|
-
activerecord (= 3.2.13)
|
63
|
-
activeresource (= 3.2.13)
|
64
|
-
activesupport (= 3.2.13)
|
65
|
-
bundler (~> 1.0)
|
66
|
-
railties (= 3.2.13)
|
67
|
-
railties (3.2.13)
|
68
|
-
actionpack (= 3.2.13)
|
69
|
-
activesupport (= 3.2.13)
|
70
|
-
rack-ssl (~> 1.3.2)
|
71
|
-
rake (>= 0.8.7)
|
72
|
-
rdoc (~> 3.4)
|
73
|
-
thor (>= 0.14.6, < 2.0)
|
74
|
-
rake (10.0.4)
|
75
|
-
rbench (0.2.3)
|
76
|
-
rdoc (3.12.2)
|
77
|
-
json (~> 1.4)
|
78
|
-
sprockets (2.2.2)
|
79
|
-
hike (~> 1.2)
|
80
|
-
multi_json (~> 1.0)
|
81
|
-
rack (~> 1.0)
|
82
|
-
tilt (~> 1.1, != 1.3.0)
|
83
|
-
thor (0.18.1)
|
84
|
-
tilt (1.4.1)
|
85
|
-
treetop (1.4.12)
|
86
|
-
polyglot
|
87
|
-
polyglot (>= 0.3.1)
|
88
|
-
tzinfo (0.3.37)
|
89
|
-
|
90
|
-
PLATFORMS
|
91
|
-
ruby
|
92
|
-
|
93
|
-
DEPENDENCIES
|
94
|
-
haml!
|
95
|
-
minitest
|
96
|
-
nokogiri
|
97
|
-
rails (>= 3.2.0, < 3.3.0)
|
98
|
-
rbench
|