filtered variables for assign, case, and cycle

This commit is contained in:
James MacAulay
2008-10-15 17:02:26 -04:00
parent 282786d7e2
commit edf7b5577b
5 changed files with 29 additions and 6 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ module Liquid
# {{ monkey }}
#
class Assign < Tag
Syntax = /(#{VariableSignature}+)\s*=\s*(#{QuotedFragment}+)/
Syntax = /(#{VariableSignature}+)\s*=\s*(#{Expression}+)/
def initialize(tag_name, markup, tokens)
if markup =~ Syntax
+2 -2
View File
@@ -1,7 +1,7 @@
module Liquid
class Case < Block
Syntax = /(#{QuotedFragment})/
WhenSyntax = /(#{QuotedFragment})(?:(?:\s+or\s+|\s*\,\s*)(#{QuotedFragment}.*))?/
Syntax = /(#{Expression})/
WhenSyntax = /(#{Expression})(?:(?:\s+or\s+|\s*\,\s*)(#{Expression}.*))?/
def initialize(tag_name, markup, tokens)
@blocks = []
+3 -3
View File
@@ -13,8 +13,8 @@ module Liquid
# <div class="green"> Item five</div>
#
class Cycle < Tag
SimpleSyntax = /#{QuotedFragment}/
NamedSyntax = /(#{QuotedFragment})\s*\:\s*(.*)/
SimpleSyntax = /#{Expression}/
NamedSyntax = /(#{Expression})\s*\:\s*(.*)/
def initialize(tag_name, markup, tokens)
case markup
@@ -49,7 +49,7 @@ module Liquid
def variables_from_string(markup)
markup.split(',').collect do |var|
var =~ /\s*(#{QuotedFragment})\s*/
var =~ /\s*(#{Expression})\s*/
$1 ? $1 : nil
end.compact
end