Convert the table data to HTML, ensuring each row and cell is represented.
(self, style_args: StyleArg)
| 927 | return table_shape |
| 928 | |
| 929 | def to_html(self, style_args: StyleArg) -> str: |
| 930 | """ |
| 931 | Convert the table data to HTML, ensuring each row and cell is represented. |
| 932 | """ |
| 933 | # If there’s no content at all, return "" |
| 934 | if not self.data["content"]: |
| 935 | return "" |
| 936 | |
| 937 | rows_html = [] |
| 938 | for row_cells in self.data["content"]: |
| 939 | # If a row is empty, skip it (or handle however you like) |
| 940 | if not row_cells: |
| 941 | continue |
| 942 | |
| 943 | # Build each cell |
| 944 | cells_html = "".join( |
| 945 | f"<td>{(cell_text or '').strip()}</td>" |
| 946 | for cell_text in row_cells |
| 947 | ) |
| 948 | rows_html.append(f"<tr>{cells_html}</tr>") |
| 949 | |
| 950 | # If after filtering empty rows we have nothing, return empty |
| 951 | if not rows_html: |
| 952 | return "" |
| 953 | |
| 954 | table_html = f"{self.indent}<table{self.get_inline_style(style_args)}>\n" |
| 955 | table_html += "\n".join(rows_html) |
| 956 | table_html += f"\n{self.indent}</table>\n" |
| 957 | return table_html |
| 958 | |
| 959 | |
| 960 | class SlidePage: |
no test coverage detected