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

thead and tbody classes do not appear in hugo_stats.json #7318

Closed
jeromew opened this issue May 25, 2020 · 4 comments · Fixed by #7320
Closed

thead and tbody classes do not appear in hugo_stats.json #7318

jeromew opened this issue May 25, 2020 · 4 comments · Fixed by #7320

Comments

@jeromew
Copy link

jeromew commented May 25, 2020

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.71.1-A301F6B2 windows/amd64 BuildDate: 2020-05-25T09:12:07Z

Does this issue reproduce with the latest release?

yes

It seems that when I add classes on a thead or tbody element, they are not added to the list of classes the appear in hugo_stats.json. Classes added to other elements are discovered as expected.

I could not find in the code where is defined the list of html elements that are navigated during parsing. Could it be that thead and tbody are missing from this list ?

I could not find an explanation to what I observe other than a special case regarding thead and tbody.

when html contains

    <table class="cl1">
    <thead class="cl2"><tr class="cl3"><td class="cl4"></td></tr></thead>
    <tbody class="cl5"><tr class="cl6"><td class="cl7"></td></tr></tbody>
    </table>

only cl1 appears in hugo_stats.json

@bep
Copy link
Member

bep commented May 25, 2020

I have pushed a fix in a PR. My mistake, it seems that the net/html parser does not handle isolated thead elements etc. I have revised the strategy by just making everything a DIV (but storing the original element tag).

@jeromew
Copy link
Author

jeromew commented May 25, 2020

thanks for the quick response. In fact I was going to update the issue it seems it is not related to thead or tbody, but all elements inside table.

With

<table class="cl1">
    <tr class="cl3"><td class="cl4"></td></tr>
    <tr class="cl6"><td class="cl7"></td></tr>
    </table>

I also get only cl1

@bep
Copy link
Member

bep commented May 25, 2020

Yes, I saw that -- this should handle it: #7320

bep added a commit to bep/hugo that referenced this issue May 26, 2020
@bep bep closed this as completed in #7320 May 27, 2020
@bep bep modified the milestones: 0.71.2, v0.72 May 31, 2020
muenchhausen pushed a commit to muenchhausen/hugo that referenced this issue Jun 24, 2020
muenchhausen pushed a commit to muenchhausen/hugo that referenced this issue Jun 24, 2020
@github-actions
Copy link

github-actions bot commented Feb 2, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants