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

Template parsing issue with handlebars in a string #34

Closed
brainlid opened this issue Feb 12, 2020 · 1 comment
Closed

Template parsing issue with handlebars in a string #34

brainlid opened this issue Feb 12, 2020 · 1 comment

Comments

@brainlid
Copy link
Contributor

brainlid commented Feb 12, 2020

This may be an odd edge case. But check this out...

~H"""
<div style="height: {{ @dragging_height }}px;">
</div>
"""

This results the following compilation error.

== Compilation error in file lib/fe_web/views/editor/item.ex ==
** (TokenMissingError) lib/fe_web/views/editor/item.ex:74: missing terminator: " (for string starting at line 74)
    (eex 1.10.1) lib/eex/compiler.ex:45: EEx.Compiler.generate_buffer/4
    expanding macro: Surface.sigil_H/2
    lib/fe_web/views/editor/item.ex:73: FeWeb.Editor.Item.render/1
    (elixir 1.10.1) expanding macro: Kernel.if/2
    lib/fe_web/views/editor/item.ex:72: FeWeb.Editor.Item.render/1

Rewriting it this way fixed the issue.

style_text = "height: #{assigns.dragging_height}px;"
~H"""
<div style={{style_text}}>
</div>
"""

The issue appears to be when putting {{ @stuff }} inside a string it confuses the parser.

@msaraiva
Copy link
Member

Fixed in 1707966

@brainlid thanks for reporting this.

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

2 participants