webdump

Fork of git://git.codemadness.org/webdump
git clone git://git.z3bra.org/webdump.git
Log | Files | Refs | README | LICENSE

commit f0ca16646b1fb7dee023f09e01def7c257d4ab00
parent d7198b3833b3ab4187d1a3bfa13ac285cc9bb4e6
Author: Willy Goiffon <dev@z3bra.org>
Date:   Tue, 22 Oct 2019 14:33:07 +0200

Better table rendering (skip <br> in <td></td>)

Diffstat:
webdump.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/webdump.c b/webdump.c @@ -530,7 +530,8 @@ xmltagstart(XMLParser *x, const char *t, size_t tl) if (!strcasecmp(cur->tag, "br")) { prvnode = curnode; curnode--; - printf("\n"); + if (!(&nodes[curnode])->displaytype & DisplayTableCell) + printf("\n"); } } @@ -651,7 +652,7 @@ xmltagstartparsed(XMLParser *p, const char *t, size_t tl, int isshort) } else if (cur->displaytype & DisplayHeader) { fputs("\n", stdout); } else if (cur->displaytype & DisplayTableRow) { - fputs("\n", stdout); + ; } else if (cur->displaytype & DisplayTableCell) { fputs("\t", stdout); } else if (cur->displaytype & DisplayList) { @@ -663,7 +664,7 @@ xmltagstartparsed(XMLParser *p, const char *t, size_t tl, int isshort) if (nodes[i].displaytype & DisplayListItem) continue; if (nodes[i].displaytype & DisplayList) - fputs(" ", stdout); + fputs("\t", stdout); } /* TODO: for <ol>, keep list counter on ol element (parent), support ordered number type only */