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

Class TableHeader to_html method does not use correct table tags #98

Open
Cerebex opened this issue Jul 25, 2024 · 0 comments
Open

Class TableHeader to_html method does not use correct table tags #98

Cerebex opened this issue Jul 25, 2024 · 0 comments

Comments

@Cerebex
Copy link

Cerebex commented Jul 25, 2024

The current code is as follows:

def to_html(self, include_children=False, recurse=False):
    """
    Returns html for a <th> with html from all the cells in the row as <td>
    """
    html_str = "<th>"
    for cell in self.cells:
        html_str = html_str + cell.to_html()
    html_str = html_str + "</th>"
    return html_str

The proper format for html tables is shown here: w3 school html tables

<table>
  <tr>
    <th>Company</th>
    <th>Contact</th>
    <th>Country</th>
  </tr>
  <tr>
    <td>Alfreds Futterkiste</td>
    <td>Maria Anders</td>
    <td>Germany</td>
  </tr>
  <tr>
    <td>Centro comercial Moctezuma</td>
    <td>Francisco Chang</td>
    <td>Mexico</td>
  </tr>
</table>

For this reason, this function should instead returns html for a with html from all the cells in the row as .

This means this to_html must be changed from to and the class TableCell to_html method most likely needs to be changed aswell to make sure for header rows the encompassing tags are instead of .

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

1 participant