mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Fix for bug
http://groups-beta.google.com/group/haml/msg/b36e951ee196a5ec in trunk (thanks cameron). git-svn-id: svn://hamptoncatlin.com/haml/trunk@273 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
parent
577f413d58
commit
3fc1eb7688
4 changed files with 31 additions and 21 deletions
|
@ -103,7 +103,7 @@ module Haml
|
|||
}.merge options
|
||||
@precompiled = @options[:precompiled]
|
||||
|
||||
@template = template #String
|
||||
@template = template.strip #String
|
||||
@to_close_stack = []
|
||||
@output_tabs = 0
|
||||
@template_tabs = 0
|
||||
|
@ -153,32 +153,38 @@ module Haml
|
|||
old_index = nil
|
||||
old_spaces = nil
|
||||
old_tabs = nil
|
||||
(@template + "\n\n").each_with_index do |line, index|
|
||||
(@template + "\n-#").each_with_index do |line, index|
|
||||
spaces, tabs = count_soft_tabs(line)
|
||||
line = line.strip
|
||||
|
||||
if old_line
|
||||
block_opened = tabs > old_tabs && !line.empty?
|
||||
|
||||
suppress_render = handle_multiline(old_tabs, old_line, old_index)
|
||||
|
||||
if !suppress_render
|
||||
line_empty = old_line.empty?
|
||||
process_indent(old_tabs, old_line) unless line_empty
|
||||
flat = @flat_spaces != -1
|
||||
if !line.empty?
|
||||
if old_line
|
||||
block_opened = tabs > old_tabs && !line.empty?
|
||||
|
||||
suppress_render = handle_multiline(old_tabs, old_line, old_index)
|
||||
|
||||
if !suppress_render
|
||||
line_empty = old_line.empty?
|
||||
process_indent(old_tabs, old_line) unless line_empty
|
||||
flat = @flat_spaces != -1
|
||||
|
||||
if flat
|
||||
push_flat(old_line, old_spaces)
|
||||
elsif !line_empty
|
||||
process_line(old_line, old_index, block_opened)
|
||||
if flat
|
||||
push_flat(old_line, old_spaces)
|
||||
elsif !line_empty
|
||||
process_line(old_line, old_index, block_opened)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
old_line = line
|
||||
old_index = index
|
||||
old_spaces = spaces
|
||||
old_tabs = tabs
|
||||
elsif @flat_spaces != -1
|
||||
push_flat(old_line, old_spaces)
|
||||
old_line = ''
|
||||
old_spaces = 0
|
||||
end
|
||||
|
||||
old_line = line
|
||||
old_index = index
|
||||
old_spaces = spaces
|
||||
old_tabs = tabs
|
||||
end
|
||||
|
||||
# Close all the open tags
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<strong apos="Foo's bar!">Boo!</strong>
|
||||
<div class='render'><em>wow!</em></div>
|
||||
stuff followed by whitespace
|
||||
<strong>block with whitespace</strong>
|
||||
<p>
|
||||
Escape
|
||||
- character
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<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>
|
||||
<strong>This should!</strong>
|
||||
<textarea>
|
||||
___ ___ ___ ___
 /\__\ /\ \ /\__\ /\__\
 /:/ / /::\ \ /::| | /:/ /
 /:/__/ /:/\:\ \ /:|:| | /:/ /
 /::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ /
 /:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/
 \/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \
 \::/ / \::/ / /:/ / \:\ \
 /:/ / /:/ / /:/ / \:\ \
 /:/ / /:/ / /:/ / \:\__\
 \/__/ \/__/ \/__/ \/__/
 
 Many
 thanks
 to
 http://www.network-science.de/ascii/

|
||||
___ ___ ___ ___
 /\__\ /\ \ /\__\ /\__\
 /:/ / /::\ \ /::| | /:/ /
 /:/__/ /:/\:\ \ /:|:| | /:/ /
 /::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ /
 /:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/
 \/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \
 \::/ / \::/ / /:/ / \:\ \
 /:/ / /:/ / /:/ / \:\ \
 /:/ / /:/ / /:/ / \:\__\
 \/__/ \/__/ \/__/ \/__/

 Many
 thanks
 to
 http://www.network-science.de/ascii/

|
||||
<strong>indeed!</strong>
|
||||
</textarea>
|
||||
</div>
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
.render= render :inline => "%em= 'wow!'", :type => :haml
|
||||
= "stuff followed by whitespace"
|
||||
|
||||
- if true
|
||||
|
||||
%strong block with whitespace
|
||||
%p
|
||||
\Escape
|
||||
\- character
|
||||
|
|
Loading…
Reference in a new issue