Closed duanzhichao closed 3 years ago
Thanks for the report @duanzhichao. This has been fixed in master and in the v0.16 branch, so please use one of them until we have a new release.
Thanks for the report @duanzhichao. This has been fixed in master and in the v0.16 branch, so please use one of them until we have a new release.
Thanks
I just had this error occur with use of (non-compiled) liquid template string examples. For example:
iex(7)> ~H"""
...(7)> <div>
...(7)> Liquid String Example:
...(7)> {% if 1 < 2 %}
...(7)> Example is shown
...(7)> {% endif %}
...(7)> </div>
...(7)> """
** (Phoenix.LiveView.HTMLTokenizer.ParseError) iex:10:12: expected tag name
(phoenix_live_view 0.17.11) lib/phoenix_live_view/html_tokenizer.ex:226: Phoenix.LiveView.HTMLTokenizer.handle_tag_open/5
(phoenix_live_view 0.17.11) lib/phoenix_live_view/html_engine.ex:122: Phoenix.LiveView.HTMLEngine.handle_text/3
(eex 1.13.3) lib/eex/compiler.ex:49: EEx.Compiler.generate_buffer/4
(phoenix_live_view 0.17.11) expanding macro: Phoenix.LiveView.Helpers.sigil_H/2
iex:7: (file)
Is this still a bug or is there a known work-around for such cases? It seems like it's any time you have a naked <
in your HTML.
iex(8)> ~H|<div>1 < 2</div>|
** (Phoenix.LiveView.HTMLTokenizer.ParseError) iex:9:9: expected tag name
(phoenix_live_view 0.17.11) lib/phoenix_live_view/html_tokenizer.ex:226: Phoenix.LiveView.HTMLTokenizer.handle_tag_open/5
(phoenix_live_view 0.17.11) lib/phoenix_live_view/html_engine.ex:122: Phoenix.LiveView.HTMLEngine.handle_text/3
(eex 1.13.3) lib/eex/compiler.ex:49: EEx.Compiler.generate_buffer/4
(phoenix_live_view 0.17.11) expanding macro: Phoenix.LiveView.Helpers.sigil_H/2
iex:8: (file)
Would this be resolved by a lookahead in the parser, only raising an error for expected tag name if an opening tag (<
) is followed immediately by an allowed character for tag names?
Code
Error