File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -13,15 +13,15 @@ class ERB < Scanner
13
13
KINDS_NOT_LOC = HTML ::KINDS_NOT_LOC
14
14
15
15
ERB_RUBY_BLOCK = /
16
- <%(?!%)[=-]?
17
- (?>
16
+ ( <%(?!%)[-= \# ]?)
17
+ (( ?>
18
18
[^\- %]* # normal*
19
19
(?> # special
20
20
(?: %(?!>) | -(?!%>) )
21
21
[^\- %]* # normal*
22
22
)*
23
- )
24
- (?: -?%> )?
23
+ ))
24
+ (( ?: -?%> )?)
25
25
/x # :nodoc:
26
26
27
27
START_OF_ERB = /
@@ -48,21 +48,25 @@ def scan_tokens encoder, options
48
48
@html_scanner . tokenize match , :tokens => encoder
49
49
50
50
elsif match = scan ( /#{ ERB_RUBY_BLOCK } /o )
51
- start_tag = match [ /\A <%[-=#]?/ ]
52
- end_tag = match [ /-?%?>?\z / ]
51
+ start_tag = self [ 1 ]
52
+ code = self [ 2 ]
53
+ end_tag = self [ 3 ]
54
+
53
55
encoder . begin_group :inline
54
56
encoder . text_token start_tag , :inline_delimiter
55
- code = match [ start_tag . size .. - 1 - end_tag . size ]
56
- if start_tag [ / \A <%#/ ]
57
+
58
+ if start_tag == ' <%#'
57
59
encoder . text_token code , :comment
58
60
else
59
61
@ruby_scanner . tokenize code , :tokens => encoder
60
62
end unless code . empty?
63
+
61
64
encoder . text_token end_tag , :inline_delimiter unless end_tag . empty?
62
65
encoder . end_group :inline
63
66
64
67
else
65
68
raise_inspect 'else-case reached!' , encoder
69
+
66
70
end
67
71
68
72
end
You can’t perform that action at this time.
0 commit comments