tablewriter icon indicating copy to clipboard operation
tablewriter copied to clipboard

Adding functionality to render a table from a HTML file

Open Nelwhix opened this issue 2 years ago • 5 comments

Completing one of the todos on the readme by adding the functionality to render table from html file. This PR adds a new dependency to the package: golang.org/x/net/html to help with parsing the html.

Nelwhix avatar Jan 18 '23 23:01 Nelwhix

Can we have more test?

olekukonko avatar Jan 21 '23 20:01 olekukonko

Could you please add tests for broken html? Thanks.

mattn avatar Jul 07 '23 01:07 mattn

@mattn I already added a test for when there are some unclosed tags. What other edge cases should I test for ?

Nelwhix avatar Jul 07 '23 01:07 Nelwhix

For example:

<tr>
 <td>foo</td>
</tr>
<tr>
 <th>bar</th>
</tr>

mattn avatar Jul 07 '23 01:07 mattn

For example:

<tr>
 <td>foo</td>
</tr>
<tr>
 <th>bar</th>
</tr>

Okay added that, it returns :

// 	Output: *=====*
	// | BAR |
	// *=====*
	// | foo |
	// *=====*

Nelwhix avatar Jul 07 '23 21:07 Nelwhix