haml 3.1.5 → 3.1.6.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/REVISION +1 -1
- data/VERSION +1 -1
- data/lib/haml/buffer.rb +5 -1
- data/lib/haml/helpers/rails_323_textarea_fix.rb +21 -29
- data/test/haml/results/whitespace_handling.xhtml +46 -50
- metadata +52 -64
data/REVISION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
f211a9b4cf24d39942caa8e5e10c72f30276d5a7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.
|
1
|
+
3.1.6.rc.1
|
data/lib/haml/buffer.rb
CHANGED
@@ -97,6 +97,8 @@ 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
|
100
102
|
end
|
101
103
|
|
102
104
|
# Appends text to the buffer, properly tabulated.
|
@@ -157,7 +159,9 @@ module Haml
|
|
157
159
|
return result
|
158
160
|
<% else %>
|
159
161
|
|
160
|
-
|
162
|
+
return result if self.instance_variable_get(:@preserve_pattern).match(result)
|
163
|
+
|
164
|
+
has_newline = result.include?("\\n")
|
161
165
|
<% if in_tag && !nuke_inner_whitespace %>
|
162
166
|
<% unless preserve_tag %> if !has_newline <% end %>
|
163
167
|
@real_tabs -= 1
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "abstract_controller/rendering"
|
2
|
+
|
1
3
|
# Rails 3.2.3's form helpers add a newline after opening textareas, which can
|
2
4
|
# cause problems with newlines being considered content rather than markup.
|
3
5
|
# These changes fix the issue by making the helpers emit "<haml:newline/>"
|
@@ -8,42 +10,32 @@
|
|
8
10
|
# compatibility with the latest version of Rails, made at a moment when the Haml
|
9
11
|
# project is transitioning to a new maintainer.
|
10
12
|
|
11
|
-
module AbstractController
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
13
|
+
# module AbstractController
|
14
|
+
# module Rendering
|
15
|
+
# def render_to_body_with_haml(options = {})
|
16
|
+
# if rendered = render_to_body_without_haml(options)
|
17
|
+
# rendered.gsub('<haml:newline/>', "\n").html_safe
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
# alias_method_chain :render_to_body, :haml
|
21
|
+
# end
|
22
|
+
# end
|
21
23
|
|
22
24
|
module ActionView
|
25
|
+
module Helpers
|
23
26
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
rendered.gsub('<haml:newline/>', "\n").html_safe
|
27
|
+
module FormTagHelper
|
28
|
+
def text_area_tag_with_haml(*args)
|
29
|
+
text_area_tag_without_haml(*args).sub('>
', ">\n").html_safe
|
28
30
|
end
|
31
|
+
alias_method_chain :text_area_tag, :haml
|
29
32
|
end
|
30
|
-
alias_method_chain :render_template, :haml
|
31
|
-
end
|
32
|
-
|
33
|
-
module Helpers
|
34
|
-
module TagHelper
|
35
|
-
private
|
36
33
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
content = ERB::Util.h(content) if escape
|
41
|
-
"<#{name}#{tag_options}><haml:newline/>#{content}</#{name}>".html_safe
|
42
|
-
else
|
43
|
-
content_tag_string_without_haml(name, content, options, escape)
|
44
|
-
end
|
34
|
+
module FormHelper
|
35
|
+
def text_area_with_haml(*args)
|
36
|
+
text_area_without_haml(*args).sub('>
', ">\n").html_safe
|
45
37
|
end
|
46
|
-
alias_method_chain :
|
38
|
+
alias_method_chain :text_area, :haml
|
47
39
|
end
|
48
40
|
end
|
49
41
|
end
|
@@ -1,28 +1,26 @@
|
|
1
1
|
<div id='whitespace_test'>
|
2
2
|
<div class='text_area_test_area'>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
<textarea>Oneline</textarea>
|
4
|
+
</div>
|
5
|
+
<textarea>BLAH
|
6
|
+
</textarea>
|
7
7
|
<div class='text_area_test_area'>
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
<textarea>Two
lines</textarea>
|
9
|
+
</div>
|
10
|
+
<textarea>BLAH
|
11
|
+
</textarea>
|
12
12
|
<div class='text_area_test_area'>
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
<textarea>Oneline</textarea>
|
14
|
+
</div>
|
15
|
+
<textarea>BLAH</textarea>
|
16
16
|
<div class='text_area_test_area'>
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
<div id='flattened'>
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
<textarea>BLAH</textarea>
|
25
|
-
</div>
|
17
|
+
<textarea>Two
lines</textarea>
|
18
|
+
</div>
|
19
|
+
<textarea>BLAH</textarea>
|
20
|
+
<div id='flattened'><div class='text_area_test_area'>
|
21
|
+
<textarea>Two
lines</textarea>
|
22
|
+
</div>
|
23
|
+
<textarea>BLAH</textarea></div>
|
26
24
|
</div>
|
27
25
|
<div class='hithere'>
|
28
26
|
Foo bar
|
@@ -30,42 +28,40 @@
|
|
30
28
|
<pre>foo
bar</pre>
|
31
29
|
<p><pre>foo
bar</pre></p>
|
32
30
|
<p>
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
foo
|
32
|
+
bar
|
33
|
+
</p>
|
36
34
|
</div>
|
37
35
|
<div class='foo'>
|
38
36
|
13
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
<textarea>
|
38
|
+
a
|
39
|
+
</textarea>
|
42
40
|
<textarea>
a</textarea>
|
43
41
|
</div>
|
44
42
|
<div id='whitespace_test'>
|
45
43
|
<div class='text_area_test_area'>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
<textarea>Oneline</textarea>
|
45
|
+
</div>
|
46
|
+
<textarea>BLAH
|
47
|
+
</textarea>
|
50
48
|
<div class='text_area_test_area'>
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
<textarea>Two
lines</textarea>
|
50
|
+
</div>
|
51
|
+
<textarea>BLAH
|
52
|
+
</textarea>
|
55
53
|
<div class='text_area_test_area'>
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
<textarea>Oneline</textarea>
|
55
|
+
</div>
|
56
|
+
<textarea>BLAH</textarea>
|
59
57
|
<div class='text_area_test_area'>
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
<div id='flattened'>
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
<textarea>BLAH</textarea>
|
68
|
-
</div>
|
58
|
+
<textarea>Two
lines</textarea>
|
59
|
+
</div>
|
60
|
+
<textarea>BLAH</textarea>
|
61
|
+
<div id='flattened'><div class='text_area_test_area'>
|
62
|
+
<textarea>Two
lines</textarea>
|
63
|
+
</div>
|
64
|
+
<textarea>BLAH</textarea></div>
|
69
65
|
</div>
|
70
66
|
<div class='hithere'>
|
71
67
|
Foo bar
|
@@ -73,9 +69,9 @@
|
|
73
69
|
<pre>foo
bar</pre>
|
74
70
|
<p><pre>foo
bar</pre></p>
|
75
71
|
<p>
|
76
|
-
|
77
|
-
|
78
|
-
|
72
|
+
foo
|
73
|
+
bar
|
74
|
+
</p>
|
79
75
|
<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>
|
80
76
|
<strong>This should!</strong>
|
81
77
|
<textarea> ___ ___ ___ ___ 
 /\__\ /\ \ /\__\ /\__\
 /:/ / /::\ \ /::| | /:/ /
 /:/__/ /:/\:\ \ /:|:| | /:/ / 
 /::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ / 
 /:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/ 
 \/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \ 
 \::/ / \::/ / /:/ / \:\ \ 
 /:/ / /:/ / /:/ / \:\ \ 
 /:/ / /:/ / /:/ / \:\__\
 \/__/ \/__/ \/__/ \/__/
 
 Many
 thanks
 to
 http://www.network-science.de/ascii/
|
@@ -86,4 +82,4 @@
|
|
86
82
|
</div>
|
87
83
|
<pre> __ ______ __ ______
.----.| |--.|__ |.----.| |--..--------.| __ |
| __|| ||__ || __|| < | || __ |
|____||__|__||______||____||__|__||__|__|__||______|</pre>
|
88
84
|
<pre>foo
|
89
|
-
bar</pre>
|
85
|
+
bar</pre>
|
metadata
CHANGED
@@ -1,68 +1,65 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 3
|
8
|
-
- 1
|
9
|
-
- 5
|
10
|
-
version: 3.1.5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.1.6.rc.1
|
5
|
+
prerelease: 6
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Nathan Weizenbaum
|
14
9
|
- Hampton Catlin
|
15
10
|
- Norman Clarke
|
16
11
|
autorequire:
|
17
12
|
bindir: bin
|
18
13
|
cert_chain: []
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
date: 2012-05-14 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
23
17
|
name: yard
|
24
|
-
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
26
19
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 13
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
- 5
|
34
|
-
- 3
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
35
23
|
version: 0.5.3
|
36
24
|
type: :development
|
37
|
-
version_requirements: *id001
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: maruku
|
40
25
|
prerelease: false
|
41
|
-
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 0.5.3
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: maruku
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
42
35
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
hash: 25
|
47
|
-
segments:
|
48
|
-
- 0
|
49
|
-
- 5
|
50
|
-
- 9
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
51
39
|
version: 0.5.9
|
52
40
|
type: :development
|
53
|
-
|
54
|
-
|
55
|
-
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.5.9
|
48
|
+
description: ! " Haml (HTML Abstraction Markup Language) is a layer on top of
|
49
|
+
XHTML or XML\n that's designed to express the structure of XHTML or XML documents\n
|
50
|
+
\ in a non-repetitive, elegant, easy way,\n using indentation rather than
|
51
|
+
closing tags\n and allowing Ruby to be embedded with ease.\n It was originally
|
52
|
+
envisioned as a plugin for Ruby on Rails,\n but it can function as a stand-alone
|
53
|
+
templating engine.\n"
|
54
|
+
email:
|
56
55
|
- haml@googlegroups.com
|
57
56
|
- norman@njclarke.com
|
58
|
-
executables:
|
57
|
+
executables:
|
59
58
|
- haml
|
60
59
|
- html2haml
|
61
60
|
extensions: []
|
62
|
-
|
63
61
|
extra_rdoc_files: []
|
64
|
-
|
65
|
-
files:
|
62
|
+
files:
|
66
63
|
- rails/init.rb
|
67
64
|
- lib/haml/buffer.rb
|
68
65
|
- lib/haml/compiler.rb
|
@@ -455,38 +452,29 @@ files:
|
|
455
452
|
- VERSION_NAME
|
456
453
|
homepage: http://haml.info/
|
457
454
|
licenses: []
|
458
|
-
|
459
455
|
post_install_message:
|
460
456
|
rdoc_options: []
|
461
|
-
|
462
|
-
require_paths:
|
457
|
+
require_paths:
|
463
458
|
- lib
|
464
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
459
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
465
460
|
none: false
|
466
|
-
requirements:
|
467
|
-
- -
|
468
|
-
- !ruby/object:Gem::Version
|
469
|
-
|
470
|
-
|
471
|
-
- 0
|
472
|
-
version: "0"
|
473
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
461
|
+
requirements:
|
462
|
+
- - ! '>='
|
463
|
+
- !ruby/object:Gem::Version
|
464
|
+
version: '0'
|
465
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
474
466
|
none: false
|
475
|
-
requirements:
|
476
|
-
- -
|
477
|
-
- !ruby/object:Gem::Version
|
478
|
-
|
479
|
-
segments:
|
480
|
-
- 0
|
481
|
-
version: "0"
|
467
|
+
requirements:
|
468
|
+
- - ! '>'
|
469
|
+
- !ruby/object:Gem::Version
|
470
|
+
version: 1.3.1
|
482
471
|
requirements: []
|
483
|
-
|
484
472
|
rubyforge_project: haml
|
485
473
|
rubygems_version: 1.8.24
|
486
474
|
signing_key:
|
487
475
|
specification_version: 3
|
488
476
|
summary: An elegant, structured XHTML/XML templating engine.
|
489
|
-
test_files:
|
477
|
+
test_files:
|
490
478
|
- test/haml/engine_test.rb
|
491
479
|
- test/haml/helper_test.rb
|
492
480
|
- test/haml/html2haml_test.rb
|