@@ -12,7 +12,9 @@ class Liquid < Scanner
12
12
13
13
LIQUID_BLOCK = /
14
14
({[{|%])
15
+ \s
15
16
(.*?)
17
+ \s
16
18
([%|}]})
17
19
/
18
20
@@ -25,26 +27,26 @@ def setup
25
27
@liquid_attribute_scanner = CodeRay . scanner :html , tokens : @tokens , keep_tokens : true , keep_stat : true
26
28
end
27
29
28
- def scan_tokens
30
+ def scan_tokens ( tokens , options )
29
31
until eos?
30
- if ( match = scan_until ( /(?=#{ START_OF_LIQUID } )/o ) || scan_reset ) and not match . empty?
31
- @html_scanner . tokenize match , tokens : encoder
32
+ if ( match = scan_until ( /(?=#{ START_OF_LIQUID } )/o ) || scan_rest ) and not match . empty?
33
+ @html_scanner . tokenize match , tokens : tokens
32
34
elsif match = scan ( /#{ LIQUID_BLOCK } /o )
33
35
start_tag = self [ 1 ]
34
36
code = self [ 2 ]
35
37
end_tag = self [ 3 ]
36
38
37
- encoder . begin_group :inline
38
- encoder . text_token start_tag , :inline_delimiter
39
+ tokens . begin_group :inline
40
+ tokens . text_token start_tag , :inline_delimiter
39
41
40
42
unless code . empty?
41
- @liquid_attribute_scanner . tokenize code , tokens : encoder , state : :attribute
43
+ @liquid_attribute_scanner . tokenize code , tokens : tokens , state : :attribute
42
44
end
43
45
44
- encoder . text_token end_tag , :inline_delimiter unless end_tag . empty?
45
- encoder . end_group :inline
46
+ tokens . text_token end_tag , :inline_delimiter unless end_tag . empty?
47
+ tokens . end_group :inline
46
48
else
47
- raise_inspect 'else-case reached!' , encoder
49
+ raise_inspect 'else-case reached!' , tokens
48
50
end
49
51
end
50
52
end
0 commit comments