Whitespace after the last non-whitespace character is preserved for filters.

git-svn-id: svn://hamptoncatlin.com/haml/trunk@357 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2007-02-10 01:55:00 +00:00
parent 9b71d3e339
commit aa171de2e8
2 changed files with 8 additions and 4 deletions

View File

@ -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

View File

@ -36,7 +36,7 @@
<pre>&#x000A; ___&#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;</pre>
<strong>This should!</strong>
<textarea>
___ ___ ___ ___&#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;
___ ___ ___ ___ &#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;
<strong>indeed!</strong>
</textarea>
</div>
@ -88,7 +88,7 @@ foo&#x000A;
</pre>
<strong>This should!</strong>
<textarea>
___ ___ ___ ___&#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;
___ ___ ___ ___ &#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;
<strong>indeed!</strong>
</textarea>
</div>