1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Removing deprecated "~" behavior.

git-svn-id: svn://hamptoncatlin.com/haml/trunk@530 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2007-06-22 19:20:48 +00:00
parent 0141a59636
commit 36ef8739d0
4 changed files with 12 additions and 78 deletions

View file

@ -522,13 +522,10 @@ END
# Causes <tt>text</tt> to be evaluated, and Haml::Helpers#find_and_flatten
# to be run on it afterwards.
def push_flat_script(text)
unless text.empty?
push_script(text, true)
if text.empty?
raise SyntaxError.new("Tag has no content.")
else
unless @block_opened
raise SyntaxError.new('Filters must have nested text.')
end
start_flat(false)
push_script(text, true)
end
end
@ -717,8 +714,6 @@ END
flattened = (action == '~')
warn(FLAT_WARNING) if flattened && !defined?(Test::Unit)
value_exists = !value.empty?
literal_attributes = parse_literal_hash(attributes_hash)
attributes_hash = "{nil}" if attributes_hash.nil? || literal_attributes || @options[:suppress_eval]
@ -741,7 +736,7 @@ END
elsif atomic && value_exists
raise SyntaxError.new("Atomic tags can't have content.")
elsif parse && !value_exists
raise SyntaxError.new("No tag content to parse.")
raise SyntaxError.new("Tag has no content.")
end
if !@block_opened && !value_exists && @options[:autoclose].include?(tag_name)
@ -750,7 +745,7 @@ END
do_one_liner = value_exists && !parse && Buffer.one_liner?(value)
if(object_ref == "nil" && attributes_hash == "{nil}" && !flattened && (do_one_liner || !value_exists))
if object_ref == "nil" && attributes_hash == "{nil}" && !flattened && (do_one_liner || !value_exists)
# This means that we can render the tag directly to text and not process it in the buffer
open_tag = prerender_tag(tag_name, atomic, attributes)
@ -779,7 +774,7 @@ END
end
close
elsif flattened
start_flat(true)
raise SyntaxError.new("Tag has no content.")
end
end
end

View file

@ -137,12 +137,11 @@ class EngineTest < Test::Unit::TestCase
def test_syntax_errors
errs = [ "!!!\n a", "a\n b", "a\n:foo\nb", "/ a\n b",
"% a", "%p a\n b", "a\n%p=\nb", "%p=\n a",
"a\n%p~\nb", "a\n~\nb", "%p/\n a", "%p\n \t%a b",
"%a\n b\nc", "%a\n b\nc",
":notafilter\n This isn't\n a filter!",
".{} a", "\#{} a", ".= 'foo'", "%a/ b"
]
"% a", "%p a\n b", "a\n%p=\nb", "%p=\n a",
"a\n%p~\nb", "a\n~\nb", "a\n~\n b", "%p~\n b", "%p/\n a",
"%p\n \t%a b", "%a\n b\nc", "%a\n b\nc",
":notafilter\n This isn't\n a filter!",
".{} a", "\#{} a", ".= 'foo'", "%a/ b" ]
errs.each do |err|
begin
render(err)

View file

@ -33,21 +33,11 @@
foo
bar
</p>
<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;
<strong>indeed!</strong>
</textarea>
</div>
<div class='foo'>
13
<textarea>&#x000A;a&#x000A;</textarea><textarea>&#x000A;b&#x000A;</textarea><textarea>&#x000A;c&#x000A;</textarea>
</div>
<pre>
foo&#x000A;
bar
</pre>
<div id='whitespace_test'>
<div class='text_area_test_area'>
<textarea>Oneline</textarea>
@ -101,4 +91,4 @@ foo&#x000A;
<pre>
foo&#x000A;
bar
</pre>
</pre>

View file

@ -10,60 +10,10 @@
~ "<pre>foo\nbar</pre>"
%p~ "<pre>foo\nbar</pre>"
%p~ "foo\nbar"
%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!
%strong This should!
%textarea
~
___ ___ ___ ___
/\__\ /\ \ /\__\ /\__\
/:/ / /::\ \ /::| | /:/ /
/:/__/ /:/\:\ \ /:|:| | /:/ /
/::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ /
/:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/
\/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \
\::/ / \::/ / /:/ / \:\ \
/:/ / /:/ / /:/ / \:\ \
/:/ / /:/ / /:/ / \:\__\
\/__/ \/__/ \/__/ \/__/
Many
thanks
to
http://www.network-science.de/ascii/
%strong indeed!
.foo
~ 13
~ ['a', 'b', 'c'].map do |a|
- "<textarea>\n#{a}\n</textarea>"
%pre
~
foo
bar
#whitespace_test
= render :file => "_text_area.haml", :locals => { :value => "Oneline" }
= render :file => "_text_area.haml", :locals => { :value => "Two\nlines" }