diff --git a/lib/haml/engine.rb b/lib/haml/engine.rb index 3420f525..8a0e6468 100644 --- a/lib/haml/engine.rb +++ b/lib/haml/engine.rb @@ -200,9 +200,11 @@ END old_index = nil old_spaces = nil old_tabs = nil + old_uline = nil (@template + "\n-#").each_with_index do |line, index| spaces, tabs = count_soft_tabs(line) - line.strip! + uline = line.lstrip[0...-1] + line = uline.rstrip if !line.empty? if old_line @@ -222,7 +224,7 @@ END end if flat - push_flat(old_line, old_spaces) + push_flat(old_uline, old_spaces) elsif !line_empty process_line(old_line, old_index, block_opened) end @@ -237,12 +239,14 @@ END old_index = index old_spaces = spaces old_tabs = tabs + old_uline = uline elsif @flat_spaces != -1 process_indent(old_tabs, old_line) unless old_line.empty? if @flat_spaces != -1 push_flat(old_line, old_spaces) old_line = '' + old_uline = '' old_spaces = 0 end end diff --git a/test/haml/results/whitespace_handling.xhtml b/test/haml/results/whitespace_handling.xhtml index c0c75a88..5da76b36 100644 --- a/test/haml/results/whitespace_handling.xhtml +++ b/test/haml/results/whitespace_handling.xhtml @@ -36,7 +36,7 @@
___ ,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!This should! @@ -88,7 +88,7 @@ foo This should!