Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails on ERB file with <%== #27

Open
palexvs opened this issue Jul 6, 2023 · 0 comments
Open

Fails on ERB file with <%== #27

palexvs opened this issue Jul 6, 2023 · 0 comments

Comments

@palexvs
Copy link
Contributor

palexvs commented Jul 6, 2023

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant