30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/i18n/parser/erb_parser.rb', line 30
def to_ruby(source)
result = ''
= false
scanner = ERB::Compiler.new(nil).make_scanner(source)
scanner.scan do |token|
= true if token == '<%#'
if scanner.stag.nil?
result << token.to_whitespace
scanner.stag = token if ['<%', '<%-', '<%=', '<%#', "\n"].include?(token)
elsif ['%>', '-%>'].include?(token)
result << token.to_whitespace
scanner.stag = nil
else
result << ( ? token.to_whitespace : token) = false
end
end
result
end
|