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:
parent
0141a59636
commit
36ef8739d0
4 changed files with 12 additions and 78 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -33,21 +33,11 @@
|
|||
foo
|
||||
bar
|
||||
</p>
|
||||
<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/

|
||||
<strong>indeed!</strong>
|
||||
</textarea>
|
||||
</div>
|
||||
<div class='foo'>
|
||||
13
|
||||
<textarea>
a
</textarea><textarea>
b
</textarea><textarea>
c
</textarea>
|
||||
</div>
|
||||
<pre>
|
||||
foo

|
||||
bar
|
||||
</pre>
|
||||
<div id='whitespace_test'>
|
||||
<div class='text_area_test_area'>
|
||||
<textarea>Oneline</textarea>
|
||||
|
@ -101,4 +91,4 @@ foo

|
|||
<pre>
|
||||
foo

|
||||
bar
|
||||
</pre>
|
||||
</pre>
|
||||
|
|
|
@ -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" }
|
||||
|
|
Loading…
Add table
Reference in a new issue