mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Allow filters without nested text.
This commit is contained in:
parent
70778c95eb
commit
fd5fafc997
2 changed files with 10 additions and 2 deletions
|
@ -668,7 +668,6 @@ END
|
|||
# Starts a filtered block.
|
||||
def start_filtered(name)
|
||||
raise HamlError.new("Invalid filter name \":#{name}\"") unless name =~ /^\w+$/
|
||||
raise SyntaxError.new('Filters must have nested text.') unless @block_opened
|
||||
|
||||
unless filter = options[:filters][name]
|
||||
if filter == 'redcloth' || filter == 'markdown' || filter == 'textile'
|
||||
|
|
|
@ -5,7 +5,6 @@ class EngineTest < Test::Unit::TestCase
|
|||
EXCEPTION_MAP = {
|
||||
"!!!\n a" => "Illegal Nesting: Nesting within a header command is illegal.",
|
||||
"a\n b" => "Illegal Nesting: Nesting within plain text is illegal.",
|
||||
":a" => "Filters must have nested text.",
|
||||
"/ a\n b" => "Illegal Nesting: Nesting within a tag that already has content is illegal.",
|
||||
"% a" => 'Invalid tag: "% a"',
|
||||
"%p a\n b" => "Illegal Nesting: Content can't be both given on the same line as %p and nested within it.",
|
||||
|
@ -439,6 +438,16 @@ class EngineTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_empty_filter
|
||||
assert_equal(<<END, render(':javascript'))
|
||||
<script type='text/javascript'>
|
||||
//<![CDATA[
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
END
|
||||
end
|
||||
|
||||
def test_local_assigns_dont_modify_class
|
||||
assert_equal("bar\n", render("= foo", :locals => {:foo => 'bar'}))
|
||||
assert_equal(nil, defined?(foo))
|
||||
|
|
Loading…
Add table
Reference in a new issue