@@ -5,11 +5,11 @@ class Liquid < Scanner
5
5
6
6
register_for :liquid
7
7
8
- DIRECTIVE_KEYWORDS = "list| endlist|for |endfor|wrap |endwrap|if |endif|unless |endunless|elsif|assignlist|assign|cycle|capture|end|capture|fill|iflist| endiflist|else"
8
+ DIRECTIVE_KEYWORDS = "endlist|list |endfor|for |endwrap|wrap |endif|if |endunless|unless| elsif|assignlist|assign|cycle|capture|end|capture|fill|endiflist|iflist |else"
9
9
10
- DIRECTIVE_OPERATORS = "=|==|!=|>|<|<=|>=|contains"
10
+ DIRECTIVE_OPERATORS = "=|==|!=|>|<|<=|>=|contains| \+ "
11
11
12
- MATH = " ==|=|!=|>|<=|<|>"
12
+ MATH = / ==|=|!=|>|<=|<|>| \+ /
13
13
14
14
FILTER_KEYWORDS = "date|capitalize|downcase|upcase|first|last|join|sort|map|size|escape_once|escape|strip_html|strip_newlines|newline_to_br|replace_first|replace|remove_first|remove|truncate|truncatewords|prepend|append|minus|plus|times|divided_by|split|modulo"
15
15
@@ -63,7 +63,7 @@ def scan_directive(encoder, options, match)
63
63
end
64
64
scan_spaces ( encoder )
65
65
if match = scan ( /#{ MATH } / )
66
- encoder . text_token match , :char
66
+ encoder . text_token match , :operator
67
67
scan_spaces ( encoder )
68
68
scan_selector ( encoder , options , match )
69
69
end
@@ -82,7 +82,7 @@ def scan_directive(encoder, options, match)
82
82
end
83
83
84
84
def scan_output_filters ( encoder , options , match )
85
- encoder . text_token match , :delimiter
85
+ encoder . text_token match , :operator
86
86
scan_spaces ( encoder )
87
87
if directive = scan ( /#{ FILTER_KEYWORDS } / )
88
88
encoder . text_token directive , :directive
@@ -125,7 +125,6 @@ def scan_tokens(encoder, options)
125
125
if ( match = scan_until ( /(?=({{2,3}|{{1,2}%))/ ) || scan_rest ) and not match . empty? and state != :liquid
126
126
Rails . logger . debug "DEBUG: HTML scanning: #{ match } "
127
127
if match =~ /^"|^'/
128
- #match = match.sub /^"|^'/, ''
129
128
@html_scanner . tokenize ( match , { tokens : encoder , state : :attribute_value_string } )
130
129
else
131
130
@html_scanner . tokenize ( match , tokens : encoder )
0 commit comments