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

Un-terminated markup codes like <hr> cause issues #9

Closed
brainlid opened this issue Dec 13, 2019 · 4 comments · Fixed by #12
Closed

Un-terminated markup codes like <hr> cause issues #9

brainlid opened this issue Dec 13, 2019 · 4 comments · Fixed by #12

Comments

@brainlid
Copy link
Contributor

This markup was copied from an EEx template into a ~H one.

image

The problem is the <hr>. The compiler error is:

** (Surface.Translator.Parser.ParseError) /my_app/views/editor/placeholder.ex:14: expected end of string
    (surface) lib/surface/translator/parser.ex:222: Surface.Translator.Parser.parse/3
    (surface) lib/surface/translator.ex:23: Surface.Translator.run/4
    (surface) expanding macro: Surface.sigil_H/2
    (fe_web) lib/fe_web/views/editor/placeholder.ex:13: FeWeb.Editor.Placeholder.render/1
    (elixir) lib/kernel/parallel_compiler.ex:229: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7

After trial and error I realized it was the <hr>. When I changed it to <hr /> then it worked fine.

The solution is either support markup like the non-xml valid <hr> or improve the error message to help identify what the problem is.

@msaraiva
Copy link
Member

Improving the error message is the way to go. There's a new parser that still has to be merged that address this by giving the following message:

.../placeholder.ex:18: expected closing tag for "<hr>"

@brainlid
Copy link
Contributor Author

Perfect!

@msaraiva
Copy link
Member

@brainlid the new parser on master accepts HTML void elements like <br> or <hr>. No need to self-close them anymore. You can copy and paste them freely now ;)

@msaraiva
Copy link
Member

msaraiva commented Dec 25, 2019

@brainlid BTW, with the new parser you'll have to make a small change in you <Form> component. Please use:

alias Surface.Components.Raw

...

<#Raw></form></#Raw>

instead of:

{{ raw("</form>") }}

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

Successfully merging a pull request may close this issue.

2 participants