GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Fork of nex3/haml
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/chriseppstein/haml.git
Revert "Don't render unsightly XHTML newline escapes."

This reverts commit 0d4010cbaaf81541a2088a07acbbb8f723c55775.

This whole idea falls down when the toplevel template isn't necessarily 
active
when nested templates are being rendered.
Unfortunately, this is exactly the case for Rails and Merb,
which render the page template and then give the content to the layout.

This revert preserves some of the documentation added in the reverted 
commit.
nex3 (author)
Thu Apr 24 12:59:03 -0700 2008
commit  97de8a5459cc5b54040fa9c357816967228a5ccb
tree    63cd1fb75e59d88ec0b7c25dde2d7520e777f2a9
parent  0d4010cbaaf81541a2088a07acbbb8f723c55775
...
850
851
852
853
854
855
856
857
858
859
...
850
851
852
 
 
 
 
853
854
855
0
@@ -850,10 +850,6 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
 #
0
 # Blocks of literal text can be preserved using the :preserve filter (see above).
0
 #
0
-# After the top-level Haml template has been processed,
0
-# all newline escapes are converted back into literal newlines
0
-# to make the source code more readable.
0
-#
0
 # === Helpers
0
 #
0
 # Haml offers a bunch of helpers that are useful
...
87
88
89
90
91
92
93
94
95
96
97
98
99
...
87
88
89
 
 
 
 
 
 
 
90
91
92
0
@@ -87,13 +87,6 @@ module Haml
0
       @real_tabs = 0
0
     end
0
 
0
- # Returns the compiled string.
0
- # This is distinct from #buffer in that some post-processing is done.
0
- def result
0
- return buffer unless @options[:ugly] || toplevel?
0
- buffer.gsub('&#x000A;', "\n")
0
- end
0
-
0
     # Renders +text+ with the proper tabulation. This also deals with
0
     # making a possible one-line tag one line or not.
0
     def push_text(text, tab_change = 0)
...
171
172
173
174
 
175
176
177
...
171
172
173
 
174
175
176
177
0
@@ -171,7 +171,7 @@ END
0
         @haml_buffer = buffer.upper
0
       end
0
 
0
- buffer.result
0
+ buffer.buffer
0
     end
0
     alias_method :to_html, :render
0
 
...
102
103
104
105
 
106
107
108
...
102
103
104
 
105
106
107
108
0
@@ -102,7 +102,7 @@ _erbout = _hamlout.buffer
0
 END
0
       postamble = <<END.gsub("\n", ";")
0
 @haml_buffer = @haml_buffer.upper
0
-_hamlout.result
0
+_erbout
0
 END
0
       preamble + locals_code(local_names) + @precompiled + postamble
0
     end
...
121
122
123
124
 
125
126
127
 
128
129
130
...
121
122
123
 
124
125
126
 
127
128
129
130
0
@@ -121,10 +121,10 @@ END
0
   end
0
 
0
   def test_textareas
0
- assert_equal("<textarea>Foo\n bar\n baz</textarea>\n",
0
+ assert_equal("<textarea>Foo&#x000A; bar&#x000A; baz</textarea>\n",
0
                  render('%textarea= "Foo\n bar\n baz"'))
0
 
0
- assert_equal("<pre>Foo\n bar\n baz</pre>\n",
0
+ assert_equal("<pre>Foo&#x000A; bar&#x000A; baz</pre>\n",
0
                  render('%pre= "Foo\n bar\n baz"'))
0
 
0
     assert_equal("<textarea>#{'a' * 100}</textarea>\n",
...
82
83
84
85
 
86
87
88
 
89
90
91
 
92
93
94
...
141
142
143
144
 
145
146
147
148
149
 
150
151
152
...
82
83
84
 
85
86
87
 
88
89
90
 
91
92
93
94
...
141
142
143
 
144
145
146
147
148
 
149
150
151
152
0
@@ -82,13 +82,13 @@ class HelperTest < Test::Unit::TestCase
0
   end
0
 
0
   def test_text_area
0
- assert_equal(%(<textarea id="body" name="body">Foo\nBar\n Baz\n Boom</textarea>\n),
0
+ assert_equal(%(<textarea id="body" name="body">Foo&#x000A;Bar&#x000A; Baz&#x000A; Boom</textarea>\n),
0
                  render('= text_area_tag "body", "Foo\nBar\n Baz\n Boom"', :action_view))
0
 
0
- assert_equal(%(<textarea cols="40" id="post_body" name="post[body]" rows="20">Foo bar\nbaz</textarea>\n),
0
+ assert_equal(%(<textarea cols="40" id="post_body" name="post[body]" rows="20">Foo bar&#x000A;baz</textarea>\n),
0
                  render('= text_area :post, :body', :action_view))
0
 
0
- assert_equal(%(<pre>Foo bar\n baz</pre>\n),
0
+ assert_equal(%(<pre>Foo bar&#x000A; baz</pre>\n),
0
                  render('= content_tag "pre", "Foo bar\n baz"', :action_view))
0
   end
0
   
0
@@ -141,12 +141,12 @@ class HelperTest < Test::Unit::TestCase
0
   end
0
 
0
   def test_find_and_preserve_with_block
0
- assert_equal("<pre>\n Foo\n Bar\n</pre>\nFoo\nBar\n",
0
+ assert_equal("<pre>&#x000A; Foo&#x000A; Bar&#x000A;</pre>\nFoo\nBar\n",
0
                  render("= find_and_preserve do\n %pre\n Foo\n Bar\n Foo\n Bar"))
0
   end
0
 
0
   def test_preserve_with_block
0
- assert_equal("<pre>\n Foo\n Bar\n</pre>\nFoo\nBar\n\n",
0
+ assert_equal("<pre>&#x000A; Foo&#x000A; Bar&#x000A;</pre>&#x000A;Foo&#x000A;Bar&#x000A;\n",
0
                  render("= preserve do\n %pre\n Foo\n Bar\n Foo\n Bar"))
0
   end
0
 
...
41
42
43
44
45
46
47
48
49
50
51
 
 
52
53
54
...
41
42
43
 
 
 
 
 
 
 
 
44
45
46
47
48
0
@@ -41,14 +41,8 @@ This
0
  \\
0
 <p>
0
   <pre>
0
-This pre is pretty deeply
0
- nested.
0
- Does interpolation work?
0
-
0
- This one is, too.
0
-Nested, that is.
0
-
0
-
0
+This pre is pretty deeply&#x000A; nested.&#x000A; Does interpolation work?&#x000A;
0
+ This one is, too.&#x000A;Nested, that is.&#x000A;&#x000A;
0
   </pre>
0
 </p>
0
 <ul>
...
5
6
7
8
9
 
10
11
12
13
14
15
16
17
 
18
19
20
 
21
22
23
 
24
25
26
27
 
28
29
30
 
31
32
33
34
35
36
37
38
39
 
 
40
41
42
...
44
45
46
47
48
49
50
51
52
53
 
54
55
56
...
59
60
61
62
63
 
64
65
66
67
68
69
70
71
 
72
73
74
 
75
76
77
 
78
79
80
81
 
82
83
84
 
85
86
87
88
89
90
91
92
93
 
 
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
 
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
 
145
146
147
...
149
150
151
152
153
154
155
156
 
157
158
159
160
 
161
162
...
5
6
7
 
 
8
9
10
11
12
13
14
 
 
15
16
 
 
17
18
 
 
19
20
21
 
 
22
23
 
 
24
25
26
27
28
29
 
 
 
 
30
31
32
33
34
...
36
37
38
 
 
 
 
 
 
 
39
40
41
42
...
45
46
47
 
 
48
49
50
51
52
53
54
 
 
55
56
 
 
57
58
 
 
59
60
61
 
 
62
63
 
 
64
65
66
67
68
69
 
 
 
 
70
71
72
73
74
75
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
78
79
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
82
83
84
...
86
87
88
 
 
 
 
 
89
90
91
 
 
92
93
94
0
@@ -5,38 +5,30 @@
0
   <textarea>BLAH
0
   </textarea>
0
   <div class='text_area_test_area'>
0
- <textarea>Two
0
-lines</textarea>
0
+ <textarea>Two&#x000A;lines</textarea>
0
   </div>
0
   <textarea>BLAH
0
   </textarea>
0
   <div class='text_area_test_area'>
0
     <textarea>Oneline</textarea>
0
   </div>
0
- <textarea>BLAH
0
-</textarea>
0
+ <textarea>BLAH&#x000A;</textarea>
0
   <div class='text_area_test_area'>
0
- <textarea>Two
0
-lines</textarea>
0
+ <textarea>Two&#x000A;lines</textarea>
0
   </div>
0
- <textarea>BLAH
0
-</textarea>
0
+ <textarea>BLAH&#x000A;</textarea>
0
   <div id='flattened'>
0
     <div class='text_area_test_area'>
0
- <textarea>Two
0
-lines</textarea>
0
+ <textarea>Two&#x000A;lines</textarea>
0
     </div>
0
- <textarea>BLAH
0
-</textarea>
0
+ <textarea>BLAH&#x000A;</textarea>
0
   </div>
0
 </div>
0
 <div class='hithere'>
0
   Foo bar
0
   <pre>foo bar</pre>
0
- <pre>foo
0
-bar</pre>
0
- <p><pre>foo
0
-bar</pre></p>
0
+ <pre>foo&#x000A;bar</pre>
0
+ <p><pre>foo&#x000A;bar</pre></p>
0
   <p>
0
     foo
0
     bar
0
@@ -44,13 +36,7 @@ bar</pre></p>
0
 </div>
0
 <div class='foo'>
0
   13
0
- <textarea>
0
-a
0
-</textarea><textarea>
0
-b
0
-</textarea><textarea>
0
-c
0
-</textarea>
0
+ <textarea>&#x000A;a&#x000A;</textarea><textarea>&#x000A;b&#x000A;</textarea><textarea>&#x000A;c&#x000A;</textarea>
0
 </div>
0
 <div id='whitespace_test'>
0
   <div class='text_area_test_area'>
0
@@ -59,89 +45,40 @@ c
0
   <textarea>BLAH
0
   </textarea>
0
   <div class='text_area_test_area'>
0
- <textarea>Two
0
-lines</textarea>
0
+ <textarea>Two&#x000A;lines</textarea>
0
   </div>
0
   <textarea>BLAH
0
   </textarea>
0
   <div class='text_area_test_area'>
0
     <textarea>Oneline</textarea>
0
   </div>
0
- <textarea>BLAH
0
-</textarea>
0
+ <textarea>BLAH&#x000A;</textarea>
0
   <div class='text_area_test_area'>
0
- <textarea>Two
0
-lines</textarea>
0
+ <textarea>Two&#x000A;lines</textarea>
0
   </div>
0
- <textarea>BLAH
0
-</textarea>
0
+ <textarea>BLAH&#x000A;</textarea>
0
   <div id='flattened'>
0
     <div class='text_area_test_area'>
0
- <textarea>Two
0
-lines</textarea>
0
+ <textarea>Two&#x000A;lines</textarea>
0
     </div>
0
- <textarea>BLAH
0
-</textarea>
0
+ <textarea>BLAH&#x000A;</textarea>
0
   </div>
0
 </div>
0
 <div class='hithere'>
0
   Foo bar
0
   <pre>foo bar</pre>
0
- <pre>foo
0
-bar</pre>
0
- <p><pre>foo
0
-bar</pre></p>
0
+ <pre>foo&#x000A;bar</pre>
0
+ <p><pre>foo&#x000A;bar</pre></p>
0
   <p>
0
     foo
0
     bar
0
   </p>
0
   <pre>
0
- ___
0
- ,o88888
0
- ,o8888888'
0
- ,:o:o:oooo. ,8O88Pd8888"
0
- ,.::.::o:ooooOoOoO. ,oO8O8Pd888'"
0
- ,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O"
0
- , ..:.::o:ooOoOOOO8OOOOo.FdO8O8"
0
- , ..:.::o:ooOoOO8O888O8O,COCOO"
0
- , . ..:.::o:ooOoOOOO8OOOOCOCO"
0
- . ..:.::o:ooOoOoOO8O8OCCCC"o
0
- . ..:.::o:ooooOoCoCCC"o:o
0
- . ..:.::o:o:,cooooCo"oo:o:
0
- ` . . ..:.:cocoooo"'o:o:::'
0
- .` . ..::ccccoc"'o:o:o:::'
0
- :.:. ,c:cccc"':.:.:.:.:.'
0
- ..:.:"'`::::c:"'..:.:.:.:.:.' http://www.chris.com/ASCII/
0
- ...:.'.:.::::"' . . . . .'
0
- .. . ....:."' ` . . . ''
0
- . . . ...."'
0
- .. . ."' -hrr-
0
- .
0
-
0
-
0
- It's a planet!
0
-%strong This shouldn't be bold!
0
-
0
+ ___&#x000A; ,o88888&#x000A; ,o8888888'&#x000A; ,:o:o:oooo. ,8O88Pd8888"&#x000A; ,.::.::o:ooooOoOoO. ,oO8O8Pd888'"&#x000A; ,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O"&#x000A; , ..:.::o:ooOoOOOO8OOOOo.FdO8O8"&#x000A; , ..:.::o:ooOoOO8O888O8O,COCOO"&#x000A; , . ..:.::o:ooOoOOOO8OOOOCOCO"&#x000A; . ..:.::o:ooOoOoOO8O8OCCCC"o&#x000A; . ..:.::o:ooooOoCoCCC"o:o&#x000A; . ..:.::o:o:,cooooCo"oo:o:&#x000A; ` . . ..:.:cocoooo"'o:o:::'&#x000A; .` . ..::ccccoc"'o:o:o:::'&#x000A; :.:. ,c:cccc"':.:.:.:.:.'&#x000A; ..:.:"'`::::c:"'..:.:.:.:.:.' http://www.chris.com/ASCII/&#x000A; ...:.'.:.::::"' . . . . .'&#x000A; .. . ....:."' ` . . . ''&#x000A; . . . ...."'&#x000A; .. . ."' -hrr-&#x000A; .&#x000A;&#x000A;&#x000A; It's a planet!&#x000A;%strong This shouldn't be bold!&#x000A;
0
   </pre>
0
   <strong>This should!</strong>
0
   <textarea>
0
- ___ ___ ___ ___
0
- /\__\ /\ \ /\__\ /\__\
0
- /:/ / /::\ \ /::| | /:/ /
0
- /:/__/ /:/\:\ \ /:|:| | /:/ /
0
- /::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ /
0
- /:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/
0
- \/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \
0
- \::/ / \::/ / /:/ / \:\ \
0
- /:/ / /:/ / /:/ / \:\ \
0
- /:/ / /:/ / /:/ / \:\__\
0
- \/__/ \/__/ \/__/ \/__/
0
-
0
- Many
0
- thanks
0
- to
0
- http://www.network-science.de/ascii/
0
-
0
+ ___ ___ ___ ___ &#x000A; /\__\ /\ \ /\__\ /\__\&#x000A; /:/ / /::\ \ /::| | /:/ /&#x000A; /:/__/ /:/\:\ \ /:|:| | /:/ / &#x000A; /::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ / &#x000A; /:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/ &#x000A; \/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \ &#x000A; \::/ / \::/ / /:/ / \:\ \ &#x000A; /:/ / /:/ / /:/ / \:\ \ &#x000A; /:/ / /:/ / /:/ / \:\__\&#x000A; \/__/ \/__/ \/__/ \/__/&#x000A;&#x000A; Many&#x000A; thanks&#x000A; to&#x000A; http://www.network-science.de/ascii/&#x000A;
0
     <strong>indeed!</strong>
0
   </textarea>
0
 </div>
0
@@ -149,14 +86,9 @@ bar</pre></p>
0
   13
0
 </div>
0
 <pre>
0
- __ ______ __ ______
0
-.----.| |--.|__ |.----.| |--..--------.| __ |
0
-| __|| ||__ || __|| < | || __ |
0
-|____||__|__||______||____||__|__||__|__|__||______|
0
-
0
+ __ ______ __ ______&#x000A;.----.| |--.|__ |.----.| |--..--------.| __ |&#x000A;| __|| ||__ || __|| < | || __ |&#x000A;|____||__|__||______||____||__|__||__|__|__||______|&#x000A;
0
 </pre>
0
 <pre>
0
-foo
0
-
0
+foo&#x000A;
0
   bar
0
 </pre>

Comments

    No one has commented yet.