robotdana/leftovers

Fails on ERB file with `<%==`

Opened this issue · 0 comments

Leftovers fails with an error:

Leftovers::FileCollector::Error: SyntaxError: unexpected token tEQL
  when processing ....erb:...

on an ERB file that contains <%== (it's a Rails equivalent to <% raw)

But the file works in Rails, probably because it uses erubi gem instead of erb

> require 'erb'
> read = "The value of x is: <%== x %>"
> compiler = Leftovers::Precompilers::ERB.new('-')
> compiler.compile(read).first

=> "#coding:UTF-8\n\n; \n= x \n"
> require 'erb'
> read = "The value of x is: <%== x %>"
> compiler = ::ERB::Compiler.new('-')
> compiler.compile(read).first

=> "#coding:UTF-8\nprint \"The value of x is: \".freeze; print((= x ).to_s)"
> require 'erubi'
> read = "The value of x is: <%== x %>"
> Erubi::Engine.new(read).src

=> "_buf = ::String.new; _buf << 'The value of x is: '.freeze; _buf << ::Erubi.h(( x ));\n_buf.to_s\n"