diff --git a/lib/liquid/tags/case.rb b/lib/liquid/tags/case.rb index 9150b15..a9b2316 100644 --- a/lib/liquid/tags/case.rb +++ b/lib/liquid/tags/case.rb @@ -62,7 +62,6 @@ module Liquid end def record_else_condition(markup) - if not markup.strip.empty? raise SyntaxError.new("Syntax Error in tag 'case' - Valid else condition: {% else %} (no parameters) ") end @@ -71,8 +70,6 @@ module Liquid block.attach(@nodelist) @blocks << block end - - end Template.register_tag('case', Case) diff --git a/lib/liquid/tags/if.rb b/lib/liquid/tags/if.rb index 7f23dde..c7b55be 100644 --- a/lib/liquid/tags/if.rb +++ b/lib/liquid/tags/if.rb @@ -1,5 +1,4 @@ module Liquid - # If is the conditional block # # {% if user.admin %} @@ -10,7 +9,6 @@ module Liquid # # There are {% if count < 5 %} less {% else %} more {% endif %} items than you need. # - # class If < Block SyntaxHelp = "Syntax Error in tag 'if' - Valid syntax: if [expression]" Syntax = /(#{QuotedFragment})\s*([=!<>a-z_]+)?\s*(#{QuotedFragment})?/o @@ -18,9 +16,7 @@ module Liquid def initialize(tag_name, markup, tokens) @blocks = [] - push_block('if', markup) - super end @@ -71,8 +67,6 @@ module Liquid @blocks.push(block) @nodelist = block.attach(Array.new) end - - end Template.register_tag('if', If) diff --git a/test/liquid/blank_test.rb b/test/liquid/blank_test.rb index 0817d91..d948f6a 100644 --- a/test/liquid/blank_test.rb +++ b/test/liquid/blank_test.rb @@ -90,4 +90,9 @@ class BlankTest < Test::Unit::TestCase assert_equal " foobar "*(N+1), Template.parse(wrap("{% include ' foobar ' %}")).render() assert_equal " ", Template.parse(" {% include ' ' %} ").render() end + + def test_case_is_blank + assert_template_result("", wrap(" {% assign foo = 'bar' %} {% case foo %} {% when 'bar' %} {% when 'whatever' %} {% else %} {% endcase %} ")) + assert_template_result("", wrap(" {% assign foo = 'else' %} {% case foo %} {% when 'bar' %} {% when 'whatever' %} {% else %} {% endcase %} ")) + end end