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

HTML templates not properly parsed when using Floki.HTMLParser.FastHtml #383

Open
gbrlmtrz opened this issue Feb 8, 2022 · 1 comment
Open
Labels
Projects

Comments

@gbrlmtrz
Copy link

gbrlmtrz commented Feb 8, 2022

Description

The contents of an html template fail to be included in the resulting parsed structure, thus resulting in an empty template.

To Reproduce

Steps to reproduce the behavior:

  • Using Floki v0.31.0
  • Using Elixir v1.13.0
  • Using Erlang OTP v24
  • With this code:
      a = "<!doctype html><html><head></head><body><template id=\"idc\">I am a text node <p>And I am inside a p tag</p></template></body></html>"
    {:ok, doc} =  Floki.parse_document(a, html_parser: Floki.HTMLParser.FastHtml)
    
    {:ok,                                
     [
       {"html", [],
        [{"head", [], []}, {"body", [], [{"template", [{"id", "idc"}], []}]}]}
     ]}

## Expected behavior

Output should include the contents of the template.

```elixir
  {:ok,                                
   [
     {"html", [],
      [{"head", [], []}, {"body", [], [{"template", [{"id", "idc"}], ["I am a text node ", {"p", [], ["And I am inside a p tag"]}]}]}]}
   ]}
@gbrlmtrz gbrlmtrz added the Bug label Feb 8, 2022
@philss
Copy link
Owner

philss commented Feb 13, 2022

Hey @gbrlmtrz 👋
Thanks for open the issue.

I think this is a problem in FastHTML. Maybe the parser doesn't support templates yet. I will try to confirm this week.

@philss philss added this to Needs triage in Bugs via automation Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Bugs
  
Needs triage
Development

No branches or pull requests

2 participants