haml 4.0.0 → 4.0.1.rc.1
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.
- data/CHANGELOG.md +12 -2
- data/FAQ.md +2 -1
- data/lib/haml/buffer.rb +26 -5
- data/lib/haml/compiler.rb +11 -10
- data/lib/haml/helpers/action_view_mods.rb +14 -7
- data/lib/haml/options.rb +1 -1
- data/lib/haml/railtie.rb +1 -1
- data/lib/haml/version.rb +1 -1
- data/test/engine_test.rb +5 -0
- data/test/gemfiles/Gemfile.rails-3.0.x +1 -1
- data/test/gemfiles/Gemfile.rails-3.1.x +1 -1
- data/test/gemfiles/Gemfile.rails-3.1.x.lock +100 -0
- data/test/gemfiles/Gemfile.rails-3.2.x +1 -1
- data/test/gemfiles/Gemfile.rails-4.0.x +5 -0
- data/test/gemfiles/Gemfile.rails-4.0.x.lock +98 -0
- data/test/helper_test.rb +16 -28
- data/test/results/whitespace_handling.xhtml +51 -46
- metadata +38 -43
- data/lib/haml/helpers/rails_323_textarea_fix.rb +0 -24
- data/test/gemfiles/Gemfile.rails-master +0 -4
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Haml Changelog
|
2
2
|
|
3
|
+
## 4.0.1 (Unreleased)
|
4
|
+
|
5
|
+
* Remove Rails 3.2.3+ textarea hack in favor of a more general solution.
|
6
|
+
* Fix some performance regressions.
|
7
|
+
* Fix support for Rails 4 `text_area` helper method.
|
8
|
+
* Fix data attribute flattening with singleton objects.
|
9
|
+
(thanks [Alisdair McDiarmid](https://github.com/alisdair))
|
10
|
+
* Fix support for sass-rails 4.0 beta.
|
11
|
+
(thanks [Ryunosuke SATO](https://github.com/tricknotes))
|
12
|
+
|
3
13
|
## 4.0.0
|
4
14
|
|
5
15
|
* The Haml exectutable now accepts an `--autoclose` option. You can now
|
@@ -12,7 +22,7 @@
|
|
12
22
|
* HTML5 is now the default output format rather than XHTML. This was already
|
13
23
|
the default on Rails 3+, so many users will notice no difference.
|
14
24
|
|
15
|
-
* The :sass filter now wraps its output in a
|
25
|
+
* The :sass filter now wraps its output in a style tag, as do the new :less and
|
16
26
|
:scss filters. The :coffee filter wraps its output in a script tag.
|
17
27
|
|
18
28
|
* Haml now supports only Rails 3 and above, and Ruby 1.8.7 and above. If you
|
@@ -57,7 +67,7 @@
|
|
57
67
|
(thanks to [Péter Pál Koszta](https://github.com/koszta))
|
58
68
|
|
59
69
|
* Filters that rely on third-party template engines are now implemented using
|
60
|
-
[Tilt](github.com/rtomayko/tilt). Several new filters have been added, namely
|
70
|
+
[Tilt](http://github.com/rtomayko/tilt). Several new filters have been added, namely
|
61
71
|
SCSS (:scss), LessCSS, (:less), and Coffeescript (:coffee/:coffeescript).
|
62
72
|
|
63
73
|
Though the list of "official" filters is kept intentionally small, Haml comes
|
data/FAQ.md
CHANGED
data/lib/haml/buffer.rb
CHANGED
@@ -97,8 +97,6 @@ module Haml
|
|
97
97
|
# The number of tabs that Engine thinks we should have
|
98
98
|
# @real_tabs + @tabulation is the number of tabs actually output
|
99
99
|
@real_tabs = 0
|
100
|
-
|
101
|
-
@preserve_pattern = /<[\s]*#{@options[:preserve].join("|")}/i
|
102
100
|
end
|
103
101
|
|
104
102
|
# Appends text to the buffer, properly tabulated.
|
@@ -158,11 +156,9 @@ module Haml
|
|
158
156
|
<% end %>
|
159
157
|
|
160
158
|
<% if ugly %>
|
159
|
+
fix_textareas!(result, nil) if toplevel? && result.include?('<textarea')
|
161
160
|
return result
|
162
161
|
<% else %>
|
163
|
-
|
164
|
-
return result if self.instance_variable_get(:@preserve_pattern).match(result)
|
165
|
-
|
166
162
|
<% if !(in_tag && preserve_tag && !nuke_inner_whitespace) %>
|
167
163
|
has_newline = result.include?("\\n")
|
168
164
|
<% end %>
|
@@ -188,6 +184,8 @@ module Haml
|
|
188
184
|
<% if in_tag && !nuke_inner_whitespace %> result = tabs(tabulation) + result <% end %>
|
189
185
|
end
|
190
186
|
|
187
|
+
fix_textareas!(result, tabs(tabulation)) if toplevel? && result.include?('<textarea')
|
188
|
+
|
191
189
|
<% if in_tag && !nuke_inner_whitespace %>
|
192
190
|
result = "\\n\#{result}\\n\#{tabs(tabulation-1)}"
|
193
191
|
@real_tabs -= 1
|
@@ -263,6 +261,29 @@ RUBY
|
|
263
261
|
|
264
262
|
private
|
265
263
|
|
264
|
+
# Works like #{find_and_preserve}, but allows the first newline after a
|
265
|
+
# preserved opening tag to remain unencoded, and then outdents the content.
|
266
|
+
# This change was motivated primarily by the change in Rails 3.2.3 to emit
|
267
|
+
# a newline after textarea helpers.
|
268
|
+
#
|
269
|
+
# @param input [String] The text to process
|
270
|
+
# @param tabs [String] The tabs provided by the Haml::Buffer
|
271
|
+
# @param options [Hash] The options hash provided by the Haml::Buffer
|
272
|
+
# @since Haml 4.0.1
|
273
|
+
# @private
|
274
|
+
def fix_textareas!(input, tabs)
|
275
|
+
pattern = /([ ]*)<(textarea)([^>]*)>(\n|
)(.*?)(<\/\2>)/im
|
276
|
+
input.gsub!(pattern) do |s|
|
277
|
+
match = pattern.match(s)
|
278
|
+
content = match[5]
|
279
|
+
unless tabs.nil?
|
280
|
+
content.sub!(match[1].to_s, '')
|
281
|
+
content.sub!(tabs, '')
|
282
|
+
end
|
283
|
+
"#{match[1]}<#{match[2]}#{match[3]}>\n#{content}</#{match[2]}>"
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
266
287
|
if RUBY_VERSION < "1.9"
|
267
288
|
def new_encoded_string
|
268
289
|
""
|
data/lib/haml/compiler.rb
CHANGED
@@ -417,13 +417,13 @@ END
|
|
417
417
|
join_char = hyphenate_data_attrs ? '-' : '_'
|
418
418
|
|
419
419
|
attributes.each do |key, value|
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
420
|
+
if value.is_a?(Hash)
|
421
|
+
data_attributes = attributes.delete(key)
|
422
|
+
data_attributes = flatten_data_attributes(data_attributes, '', join_char)
|
423
|
+
data_attributes = build_data_keys(data_attributes, hyphenate_data_attrs, key)
|
424
|
+
attributes = data_attributes.merge(attributes)
|
425
|
+
end
|
426
|
+
end
|
427
427
|
|
428
428
|
result = attributes.collect do |attr, value|
|
429
429
|
next if value.nil?
|
@@ -449,11 +449,11 @@ END
|
|
449
449
|
value = Haml::Helpers.preserve(escaped)
|
450
450
|
if escape_attrs
|
451
451
|
# We want to decide whether or not to escape quotes
|
452
|
-
value
|
452
|
+
value.gsub!(/"|"/, '"')
|
453
453
|
this_attr_wrapper = attr_wrapper
|
454
454
|
if value.include? attr_wrapper
|
455
455
|
if value.include? other_quote_char
|
456
|
-
value
|
456
|
+
value.gsub!(attr_wrapper, quote_escape)
|
457
457
|
else
|
458
458
|
this_attr_wrapper = other_quote_char
|
459
459
|
end
|
@@ -486,10 +486,11 @@ END
|
|
486
486
|
end
|
487
487
|
|
488
488
|
def self.flatten_data_attributes(data, key, join_char, seen = [])
|
489
|
+
return {key => data} unless data.is_a?(Hash)
|
490
|
+
|
489
491
|
return {key => nil} if seen.include? data.object_id
|
490
492
|
seen << data.object_id
|
491
493
|
|
492
|
-
return {key => data} unless data.is_a?(Hash)
|
493
494
|
data.sort {|x, y| x[0].to_s <=> y[0].to_s}.inject({}) do |hash, array|
|
494
495
|
k, v = array
|
495
496
|
joined = key == '' ? k : [key, k].join(join_char)
|
@@ -82,8 +82,7 @@ module ActionView
|
|
82
82
|
alias_method :content_tag, :content_tag_with_haml
|
83
83
|
end
|
84
84
|
|
85
|
-
|
86
|
-
# Already includes TagHelper
|
85
|
+
module HamlSupport
|
87
86
|
include Haml::Helpers
|
88
87
|
|
89
88
|
def haml_buffer
|
@@ -93,6 +92,18 @@ module ActionView
|
|
93
92
|
def is_haml?
|
94
93
|
@template_object.send :is_haml?
|
95
94
|
end
|
95
|
+
end
|
96
|
+
|
97
|
+
if ActionPack::VERSION::MAJOR == 4
|
98
|
+
module Tags
|
99
|
+
class TextArea
|
100
|
+
include HamlSupport
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
class InstanceTag
|
106
|
+
include HamlSupport
|
96
107
|
|
97
108
|
def content_tag(*args, &block)
|
98
109
|
html_tag = content_tag_with_haml(*args, &block)
|
@@ -140,8 +151,4 @@ module ActionView
|
|
140
151
|
alias_method :form_for, :form_for_with_haml
|
141
152
|
end
|
142
153
|
end
|
143
|
-
end
|
144
|
-
|
145
|
-
if ((ActionPack::VERSION::MAJOR == 3) && (ActionPack::VERSION::MINOR >= 2) && (ActionPack::VERSION::TINY >= 3) || (ActionPack::VERSION::MAJOR == 4))
|
146
|
-
require "haml/helpers/rails_323_textarea_fix"
|
147
|
-
end
|
154
|
+
end
|
data/lib/haml/options.rb
CHANGED
data/lib/haml/railtie.rb
CHANGED
@@ -10,7 +10,7 @@ end
|
|
10
10
|
module Haml
|
11
11
|
class Railtie < ::Rails::Railtie
|
12
12
|
initializer :haml do |app|
|
13
|
-
if defined?(::Sass::Rails) && app.config.assets.enabled
|
13
|
+
if defined?(::Sass::Rails::SassTemplate) && app.config.assets.enabled
|
14
14
|
require "haml/sass_rails_filter"
|
15
15
|
end
|
16
16
|
end
|
data/lib/haml/version.rb
CHANGED
data/test/engine_test.rb
CHANGED
@@ -1498,6 +1498,11 @@ HAML
|
|
1498
1498
|
render("%div{data_val, :data => {:foo => 'blip', :brat => 'wurst'}}"))
|
1499
1499
|
end
|
1500
1500
|
|
1501
|
+
def test_html5_data_attributes_with_identical_attribute_values
|
1502
|
+
assert_equal("<div data-x='50' data-y='50'></div>\n",
|
1503
|
+
render("%div{:data => {:x => 50, :y => 50}}"))
|
1504
|
+
end
|
1505
|
+
|
1501
1506
|
def test_xml_doc_using_html5_format_and_mime_type
|
1502
1507
|
assert_equal(<<XML, render(<<HAML, { :format => :html5, :mime_type => 'text/xml' }))
|
1503
1508
|
<?xml version='1.0' encoding='utf-8' ?>
|
@@ -0,0 +1,100 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/norman/work/haml
|
3
|
+
specs:
|
4
|
+
haml (4.0.1)
|
5
|
+
tilt
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (3.1.11)
|
11
|
+
actionpack (= 3.1.11)
|
12
|
+
mail (~> 2.3.3)
|
13
|
+
actionpack (3.1.11)
|
14
|
+
activemodel (= 3.1.11)
|
15
|
+
activesupport (= 3.1.11)
|
16
|
+
builder (~> 3.0.0)
|
17
|
+
erubis (~> 2.7.0)
|
18
|
+
i18n (~> 0.6)
|
19
|
+
rack (~> 1.3.6)
|
20
|
+
rack-cache (~> 1.2)
|
21
|
+
rack-mount (~> 0.8.2)
|
22
|
+
rack-test (~> 0.6.1)
|
23
|
+
sprockets (~> 2.0.4)
|
24
|
+
activemodel (3.1.11)
|
25
|
+
activesupport (= 3.1.11)
|
26
|
+
builder (~> 3.0.0)
|
27
|
+
i18n (~> 0.6)
|
28
|
+
activerecord (3.1.11)
|
29
|
+
activemodel (= 3.1.11)
|
30
|
+
activesupport (= 3.1.11)
|
31
|
+
arel (~> 2.2.3)
|
32
|
+
tzinfo (~> 0.3.29)
|
33
|
+
activeresource (3.1.11)
|
34
|
+
activemodel (= 3.1.11)
|
35
|
+
activesupport (= 3.1.11)
|
36
|
+
activesupport (3.1.11)
|
37
|
+
multi_json (~> 1.0)
|
38
|
+
arel (2.2.3)
|
39
|
+
builder (3.0.4)
|
40
|
+
erubis (2.7.0)
|
41
|
+
hike (1.2.1)
|
42
|
+
i18n (0.6.2)
|
43
|
+
json (1.7.7)
|
44
|
+
mail (2.3.3)
|
45
|
+
i18n (>= 0.4.0)
|
46
|
+
mime-types (~> 1.16)
|
47
|
+
treetop (~> 1.4.8)
|
48
|
+
mime-types (1.21)
|
49
|
+
minitest (4.6.1)
|
50
|
+
multi_json (1.6.1)
|
51
|
+
nokogiri (1.5.6)
|
52
|
+
polyglot (0.3.3)
|
53
|
+
rack (1.3.10)
|
54
|
+
rack-cache (1.2)
|
55
|
+
rack (>= 0.4)
|
56
|
+
rack-mount (0.8.3)
|
57
|
+
rack (>= 1.0.0)
|
58
|
+
rack-ssl (1.3.3)
|
59
|
+
rack
|
60
|
+
rack-test (0.6.2)
|
61
|
+
rack (>= 1.0)
|
62
|
+
rails (3.1.11)
|
63
|
+
actionmailer (= 3.1.11)
|
64
|
+
actionpack (= 3.1.11)
|
65
|
+
activerecord (= 3.1.11)
|
66
|
+
activeresource (= 3.1.11)
|
67
|
+
activesupport (= 3.1.11)
|
68
|
+
bundler (~> 1.0)
|
69
|
+
railties (= 3.1.11)
|
70
|
+
railties (3.1.11)
|
71
|
+
actionpack (= 3.1.11)
|
72
|
+
activesupport (= 3.1.11)
|
73
|
+
rack-ssl (~> 1.3.2)
|
74
|
+
rake (>= 0.8.7)
|
75
|
+
rdoc (~> 3.4)
|
76
|
+
thor (~> 0.14.6)
|
77
|
+
rake (10.0.3)
|
78
|
+
rbench (0.2.3)
|
79
|
+
rdoc (3.12.2)
|
80
|
+
json (~> 1.4)
|
81
|
+
sprockets (2.0.4)
|
82
|
+
hike (~> 1.2)
|
83
|
+
rack (~> 1.0)
|
84
|
+
tilt (~> 1.1, != 1.3.0)
|
85
|
+
thor (0.14.6)
|
86
|
+
tilt (1.3.3)
|
87
|
+
treetop (1.4.12)
|
88
|
+
polyglot
|
89
|
+
polyglot (>= 0.3.1)
|
90
|
+
tzinfo (0.3.35)
|
91
|
+
|
92
|
+
PLATFORMS
|
93
|
+
ruby
|
94
|
+
|
95
|
+
DEPENDENCIES
|
96
|
+
haml!
|
97
|
+
minitest
|
98
|
+
nokogiri
|
99
|
+
rails (>= 3.1.0, < 3.2.0)
|
100
|
+
rbench
|
@@ -0,0 +1,98 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/norman/work/haml
|
3
|
+
specs:
|
4
|
+
haml (4.0.1)
|
5
|
+
tilt
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (4.0.0.beta1)
|
11
|
+
actionpack (= 4.0.0.beta1)
|
12
|
+
mail (~> 2.5.3)
|
13
|
+
actionpack (4.0.0.beta1)
|
14
|
+
activesupport (= 4.0.0.beta1)
|
15
|
+
builder (~> 3.1.0)
|
16
|
+
erubis (~> 2.7.0)
|
17
|
+
rack (~> 1.5.2)
|
18
|
+
rack-test (~> 0.6.2)
|
19
|
+
activemodel (4.0.0.beta1)
|
20
|
+
activesupport (= 4.0.0.beta1)
|
21
|
+
builder (~> 3.1.0)
|
22
|
+
activerecord (4.0.0.beta1)
|
23
|
+
activemodel (= 4.0.0.beta1)
|
24
|
+
activerecord-deprecated_finders (~> 0.0.3)
|
25
|
+
activesupport (= 4.0.0.beta1)
|
26
|
+
arel (~> 4.0.0.beta1)
|
27
|
+
activerecord-deprecated_finders (0.0.3)
|
28
|
+
activesupport (4.0.0.beta1)
|
29
|
+
i18n (~> 0.6.2)
|
30
|
+
minitest (~> 4.2)
|
31
|
+
multi_json (~> 1.3)
|
32
|
+
thread_safe (~> 0.1)
|
33
|
+
tzinfo (~> 0.3.33)
|
34
|
+
arel (4.0.0.beta1)
|
35
|
+
atomic (1.0.1)
|
36
|
+
builder (3.1.4)
|
37
|
+
erubis (2.7.0)
|
38
|
+
hike (1.2.1)
|
39
|
+
i18n (0.6.2)
|
40
|
+
json (1.7.7)
|
41
|
+
mail (2.5.3)
|
42
|
+
i18n (>= 0.4.0)
|
43
|
+
mime-types (~> 1.16)
|
44
|
+
treetop (~> 1.4.8)
|
45
|
+
mime-types (1.21)
|
46
|
+
minitest (4.6.1)
|
47
|
+
multi_json (1.6.1)
|
48
|
+
nokogiri (1.5.6)
|
49
|
+
polyglot (0.3.3)
|
50
|
+
rack (1.5.2)
|
51
|
+
rack-test (0.6.2)
|
52
|
+
rack (>= 1.0)
|
53
|
+
rails (4.0.0.beta1)
|
54
|
+
actionmailer (= 4.0.0.beta1)
|
55
|
+
actionpack (= 4.0.0.beta1)
|
56
|
+
activerecord (= 4.0.0.beta1)
|
57
|
+
activesupport (= 4.0.0.beta1)
|
58
|
+
bundler (>= 1.3.0, < 2.0)
|
59
|
+
railties (= 4.0.0.beta1)
|
60
|
+
sprockets-rails (~> 2.0.0.rc3)
|
61
|
+
railties (4.0.0.beta1)
|
62
|
+
actionpack (= 4.0.0.beta1)
|
63
|
+
activesupport (= 4.0.0.beta1)
|
64
|
+
rake (>= 0.8.7)
|
65
|
+
rdoc (~> 3.4)
|
66
|
+
thor (>= 0.17.0, < 2.0)
|
67
|
+
rake (10.0.3)
|
68
|
+
rbench (0.2.3)
|
69
|
+
rdoc (3.12.2)
|
70
|
+
json (~> 1.4)
|
71
|
+
sprockets (2.9.0)
|
72
|
+
hike (~> 1.2)
|
73
|
+
multi_json (~> 1.0)
|
74
|
+
rack (~> 1.0)
|
75
|
+
tilt (~> 1.1, != 1.3.0)
|
76
|
+
sprockets-rails (2.0.0.rc3)
|
77
|
+
actionpack (>= 3.0)
|
78
|
+
activesupport (>= 3.0)
|
79
|
+
sprockets (~> 2.8)
|
80
|
+
thor (0.17.0)
|
81
|
+
thread_safe (0.1.0)
|
82
|
+
atomic
|
83
|
+
tilt (1.3.3)
|
84
|
+
treetop (1.4.12)
|
85
|
+
polyglot
|
86
|
+
polyglot (>= 0.3.1)
|
87
|
+
tzinfo (0.3.35)
|
88
|
+
|
89
|
+
PLATFORMS
|
90
|
+
ruby
|
91
|
+
|
92
|
+
DEPENDENCIES
|
93
|
+
bundler (~> 1.3.0)
|
94
|
+
haml!
|
95
|
+
minitest
|
96
|
+
nokogiri
|
97
|
+
rails (~> 4.0.0.beta.1)
|
98
|
+
rbench
|
data/test/helper_test.rb
CHANGED
@@ -132,39 +132,27 @@ HTML
|
|
132
132
|
HAML
|
133
133
|
end
|
134
134
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
assert_equal(%(<textarea id="post_body" name="post[body]">\nFoo bar
baz</textarea>\n),
|
141
|
-
render('= text_area :post, :body', :action_view))
|
142
|
-
|
143
|
-
assert_equal(%(<pre>Foo bar
 baz</pre>\n),
|
144
|
-
render('= content_tag "pre", "Foo bar\n baz"', :action_view))
|
145
|
-
end
|
146
|
-
elsif (ActionPack::VERSION::MAJOR == 3) && (ActionPack::VERSION::MINOR >= 2) && (ActionPack::VERSION::TINY >= 3)
|
147
|
-
def test_text_area
|
148
|
-
assert_equal(%(<textarea id="body" name="body">\nFoo
Bar
 Baz
 Boom</textarea>\n),
|
149
|
-
render('= text_area_tag "body", "Foo\nBar\n Baz\n Boom"', :action_view))
|
135
|
+
def test_pre
|
136
|
+
assert_equal(%(<pre>Foo bar
 baz</pre>\n),
|
137
|
+
render('= content_tag "pre", "Foo bar\n baz"', :action_view))
|
138
|
+
end
|
150
139
|
|
151
|
-
|
152
|
-
|
140
|
+
def test_text_area
|
141
|
+
regex = /<(textarea)[^>]*>(.*?)<\/\1>/im
|
153
142
|
|
154
|
-
|
155
|
-
|
143
|
+
# Rails >= 3.2.3 adds a newline after opening textarea tags.
|
144
|
+
major, minor, tiny = ActionPack::VERSION::MAJOR, ActionPack::VERSION::MINOR, ActionPack::VERSION::TINY
|
145
|
+
if major == 4 || ((major == 3) && (minor >= 2) && (tiny >= 3))
|
146
|
+
regex = /<(textarea)[^>]*>\n(.*?)<\/\1>/im
|
156
147
|
end
|
157
|
-
else
|
158
|
-
def test_text_area
|
159
|
-
assert_equal(%(<textarea id="body" name="body">Foo
Bar
 Baz
 Boom</textarea>\n),
|
160
|
-
render('= text_area_tag "body", "Foo\nBar\n Baz\n Boom"', :action_view))
|
161
148
|
|
162
|
-
|
163
|
-
|
149
|
+
output = render('= text_area_tag "body", "Foo\nBar\n Baz\n Boom"', :action_view)
|
150
|
+
match_data = output.match(regex)
|
151
|
+
assert_equal "Foo
Bar
 Baz
 Boom", match_data[2]
|
164
152
|
|
165
|
-
|
166
|
-
|
167
|
-
|
153
|
+
output = render('= text_area :post, :body', :action_view)
|
154
|
+
match_data = output.match(regex)
|
155
|
+
assert_equal "Foo bar
baz", match_data[2]
|
168
156
|
end
|
169
157
|
|
170
158
|
def test_capture_haml
|
@@ -1,26 +1,28 @@
|
|
1
1
|
<div id='whitespace_test'>
|
2
2
|
<div class='text_area_test_area'>
|
3
|
-
|
4
|
-
</div>
|
5
|
-
<textarea>BLAH
|
6
|
-
</textarea>
|
3
|
+
<textarea>Oneline</textarea>
|
4
|
+
</div>
|
5
|
+
<textarea>BLAH
|
6
|
+
</textarea>
|
7
7
|
<div class='text_area_test_area'>
|
8
|
-
|
9
|
-
</div>
|
10
|
-
<textarea>BLAH
|
11
|
-
</textarea>
|
8
|
+
<textarea>Two
lines</textarea>
|
9
|
+
</div>
|
10
|
+
<textarea>BLAH
|
11
|
+
</textarea>
|
12
12
|
<div class='text_area_test_area'>
|
13
|
-
|
14
|
-
</div>
|
15
|
-
<textarea>BLAH</textarea>
|
13
|
+
<textarea>Oneline</textarea>
|
14
|
+
</div>
|
15
|
+
<textarea>BLAH</textarea>
|
16
16
|
<div class='text_area_test_area'>
|
17
|
-
|
18
|
-
</div>
|
19
|
-
<textarea>BLAH</textarea>
|
20
|
-
<div id='flattened'
|
21
|
-
|
22
|
-
</
|
23
|
-
|
17
|
+
<textarea>Two
lines</textarea>
|
18
|
+
</div>
|
19
|
+
<textarea>BLAH</textarea>
|
20
|
+
<div id='flattened'>
|
21
|
+
<div class='text_area_test_area'>
|
22
|
+
<textarea>Two
lines</textarea>
|
23
|
+
</div>
|
24
|
+
<textarea>BLAH</textarea>
|
25
|
+
</div>
|
24
26
|
</div>
|
25
27
|
<div class='hithere'>
|
26
28
|
Foo bar
|
@@ -28,40 +30,43 @@
|
|
28
30
|
<pre>foo
bar</pre>
|
29
31
|
<p><pre>foo
bar</pre></p>
|
30
32
|
<p>
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
foo
|
34
|
+
bar
|
35
|
+
</p>
|
34
36
|
</div>
|
35
37
|
<div class='foo'>
|
36
38
|
13
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
<textarea
|
39
|
+
<textarea>
|
40
|
+
a
|
41
|
+
</textarea>
|
42
|
+
<textarea>
|
43
|
+
a</textarea>
|
41
44
|
</div>
|
42
45
|
<div id='whitespace_test'>
|
43
46
|
<div class='text_area_test_area'>
|
44
|
-
|
45
|
-
</div>
|
46
|
-
<textarea>BLAH
|
47
|
-
</textarea>
|
47
|
+
<textarea>Oneline</textarea>
|
48
|
+
</div>
|
49
|
+
<textarea>BLAH
|
50
|
+
</textarea>
|
48
51
|
<div class='text_area_test_area'>
|
49
|
-
|
50
|
-
</div>
|
51
|
-
<textarea>BLAH
|
52
|
-
</textarea>
|
52
|
+
<textarea>Two
lines</textarea>
|
53
|
+
</div>
|
54
|
+
<textarea>BLAH
|
55
|
+
</textarea>
|
53
56
|
<div class='text_area_test_area'>
|
54
|
-
|
55
|
-
</div>
|
56
|
-
<textarea>BLAH</textarea>
|
57
|
+
<textarea>Oneline</textarea>
|
58
|
+
</div>
|
59
|
+
<textarea>BLAH</textarea>
|
57
60
|
<div class='text_area_test_area'>
|
58
|
-
|
59
|
-
</div>
|
60
|
-
<textarea>BLAH</textarea>
|
61
|
-
<div id='flattened'
|
62
|
-
|
63
|
-
</
|
64
|
-
|
61
|
+
<textarea>Two
lines</textarea>
|
62
|
+
</div>
|
63
|
+
<textarea>BLAH</textarea>
|
64
|
+
<div id='flattened'>
|
65
|
+
<div class='text_area_test_area'>
|
66
|
+
<textarea>Two
lines</textarea>
|
67
|
+
</div>
|
68
|
+
<textarea>BLAH</textarea>
|
69
|
+
</div>
|
65
70
|
</div>
|
66
71
|
<div class='hithere'>
|
67
72
|
Foo bar
|
@@ -69,9 +74,9 @@
|
|
69
74
|
<pre>foo
bar</pre>
|
70
75
|
<p><pre>foo
bar</pre></p>
|
71
76
|
<p>
|
72
|
-
|
73
|
-
|
74
|
-
|
77
|
+
foo
|
78
|
+
bar
|
79
|
+
</p>
|
75
80
|
<pre> ___
 ,o88888
 ,o8888888'
 ,:o:o:oooo. ,8O88Pd8888"
 ,.::.::o:ooooOoOoO. ,oO8O8Pd888'"
 ,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O"
 , ..:.::o:ooOoOOOO8OOOOo.FdO8O8"
 , ..:.::o:ooOoOO8O888O8O,COCOO"
 , . ..:.::o:ooOoOOOO8OOOOCOCO"
 . ..:.::o:ooOoOoOO8O8OCCCC"o
 . ..:.::o:ooooOoCoCCC"o:o
 . ..:.::o:o:,cooooCo"oo:o:
 ` . . ..:.:cocoooo"'o:o:::'
 .` . ..::ccccoc"'o:o:o:::'
 :.:. ,c:cccc"':.:.:.:.:.'
 ..:.:"'`::::c:"'..:.:.:.:.:.' http://www.chris.com/ASCII/
 ...:.'.:.::::"' . . . . .'
 .. . ....:."' ` . . . ''
 . . . ...."'
 .. . ."' -hrr-
 .


 It's a planet!
%strong This shouldn't be bold!</pre>
|
76
81
|
<strong>This should!</strong>
|
77
82
|
<textarea> ___ ___ ___ ___ 
 /\__\ /\ \ /\__\ /\__\
 /:/ / /::\ \ /::| | /:/ /
 /:/__/ /:/\:\ \ /:|:| | /:/ / 
 /::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ / 
 /:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/ 
 \/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \ 
 \::/ / \::/ / /:/ / \:\ \ 
 /:/ / /:/ / /:/ / \:\ \ 
 /:/ / /:/ / /:/ / \:\__\
 \/__/ \/__/ \/__/ \/__/
 
 Many
 thanks
 to
 http://www.network-science.de/ascii/
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 4.0.
|
4
|
+
prerelease: 6
|
5
|
+
version: 4.0.1.rc.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Nathan Weizenbaum
|
@@ -11,88 +11,88 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-02-
|
14
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
|
18
|
-
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
17
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
18
|
requirements:
|
21
19
|
- - ! '>='
|
22
20
|
- !ruby/object:Gem::Version
|
23
21
|
version: '0'
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
22
|
none: false
|
23
|
+
type: :runtime
|
24
|
+
name: tilt
|
25
|
+
prerelease: false
|
26
|
+
requirement: !ruby/object:Gem::Requirement
|
26
27
|
requirements:
|
27
28
|
- - ! '>='
|
28
29
|
- !ruby/object:Gem::Version
|
29
30
|
version: '0'
|
30
|
-
|
31
|
-
type: :runtime
|
31
|
+
none: false
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
|
+
version_requirements: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 3.0.0
|
38
|
+
none: false
|
39
|
+
type: :development
|
33
40
|
name: rails
|
41
|
+
prerelease: false
|
34
42
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
43
|
requirements:
|
37
44
|
- - ! '>='
|
38
45
|
- !ruby/object:Gem::Version
|
39
46
|
version: 3.0.0
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
47
|
none: false
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
50
|
requirements:
|
43
51
|
- - ! '>='
|
44
52
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
46
|
-
|
53
|
+
version: '0'
|
54
|
+
none: false
|
47
55
|
type: :development
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
56
|
name: rbench
|
57
|
+
prerelease: false
|
50
58
|
requirement: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
59
|
requirements:
|
53
60
|
- - ! '>='
|
54
61
|
- !ruby/object:Gem::Version
|
55
62
|
version: '0'
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
63
|
none: false
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
66
|
requirements:
|
59
67
|
- - ! '>='
|
60
68
|
- !ruby/object:Gem::Version
|
61
69
|
version: '0'
|
62
|
-
|
70
|
+
none: false
|
63
71
|
type: :development
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
72
|
name: minitest
|
73
|
+
prerelease: false
|
66
74
|
requirement: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
75
|
requirements:
|
69
76
|
- - ! '>='
|
70
77
|
- !ruby/object:Gem::Version
|
71
78
|
version: '0'
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
79
|
none: false
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
82
|
requirements:
|
75
83
|
- - ! '>='
|
76
84
|
- !ruby/object:Gem::Version
|
77
85
|
version: '0'
|
78
|
-
|
86
|
+
none: false
|
79
87
|
type: :development
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
88
|
name: nokogiri
|
89
|
+
prerelease: false
|
82
90
|
requirement: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
91
|
requirements:
|
85
92
|
- - ! '>='
|
86
93
|
- !ruby/object:Gem::Version
|
87
94
|
version: '0'
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
95
|
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
94
|
-
prerelease: false
|
95
|
-
type: :development
|
96
96
|
description: ! 'Haml (HTML Abstraction Markup Language) is a layer on top of HTML
|
97
97
|
or XML that''s
|
98
98
|
|
@@ -122,7 +122,6 @@ files:
|
|
122
122
|
- lib/haml/helpers/action_view_extensions.rb
|
123
123
|
- lib/haml/helpers/action_view_mods.rb
|
124
124
|
- lib/haml/helpers/action_view_xss_mods.rb
|
125
|
-
- lib/haml/helpers/rails_323_textarea_fix.rb
|
126
125
|
- lib/haml/helpers/safe_erubis_template.rb
|
127
126
|
- lib/haml/helpers/xss_mods.rb
|
128
127
|
- lib/haml/helpers.rb
|
@@ -145,8 +144,10 @@ files:
|
|
145
144
|
- test/filters_test.rb
|
146
145
|
- test/gemfiles/Gemfile.rails-3.0.x
|
147
146
|
- test/gemfiles/Gemfile.rails-3.1.x
|
147
|
+
- test/gemfiles/Gemfile.rails-3.1.x.lock
|
148
148
|
- test/gemfiles/Gemfile.rails-3.2.x
|
149
|
-
- test/gemfiles/Gemfile.rails-
|
149
|
+
- test/gemfiles/Gemfile.rails-4.0.x
|
150
|
+
- test/gemfiles/Gemfile.rails-4.0.x.lock
|
150
151
|
- test/helper_test.rb
|
151
152
|
- test/markaby/standard.mab
|
152
153
|
- test/mocks/article.rb
|
@@ -244,26 +245,20 @@ rdoc_options: []
|
|
244
245
|
require_paths:
|
245
246
|
- lib
|
246
247
|
required_ruby_version: !ruby/object:Gem::Requirement
|
247
|
-
none: false
|
248
248
|
requirements:
|
249
249
|
- - ! '>='
|
250
250
|
- !ruby/object:Gem::Version
|
251
|
-
segments:
|
252
|
-
- 0
|
253
|
-
hash: 3355577792412640496
|
254
251
|
version: '0'
|
255
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
256
252
|
none: false
|
253
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
254
|
requirements:
|
258
|
-
- - ! '
|
255
|
+
- - ! '>'
|
259
256
|
- !ruby/object:Gem::Version
|
260
|
-
|
261
|
-
|
262
|
-
hash: 3355577792412640496
|
263
|
-
version: '0'
|
257
|
+
version: 1.3.1
|
258
|
+
none: false
|
264
259
|
requirements: []
|
265
260
|
rubyforge_project:
|
266
|
-
rubygems_version: 1.8.
|
261
|
+
rubygems_version: 1.8.23
|
267
262
|
signing_key:
|
268
263
|
specification_version: 3
|
269
264
|
summary: An elegant, structured (X)HTML/XML templating engine.
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# As of 3.2.3, Rails's form helpers add a newline after opening textareas,
|
2
|
-
# which can cause problems with newlines being considered content rather than
|
3
|
-
# markup. Here we decode the first newline back into a real newline to make the
|
4
|
-
# textarea work as expected. Note that in order for this to work, the compiler
|
5
|
-
# code was also change to avoid indenting code with textareas, even when Haml
|
6
|
-
# is running in indented mode.
|
7
|
-
module ActionView
|
8
|
-
module Helpers
|
9
|
-
|
10
|
-
module FormTagHelper
|
11
|
-
def text_area_tag_with_haml(*args)
|
12
|
-
text_area_tag_without_haml(*args).sub('>
', ">\n").html_safe
|
13
|
-
end
|
14
|
-
alias_method_chain :text_area_tag, :haml
|
15
|
-
end
|
16
|
-
|
17
|
-
module FormHelper
|
18
|
-
def text_area_with_haml(*args)
|
19
|
-
text_area_without_haml(*args).sub('>
', ">\n").html_safe
|
20
|
-
end
|
21
|
-
alias_method_chain :text_area, :haml
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|