webdump

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

commit 3d97a618cb1a5740c8356fda3060f95d9610430d
parent 20864299480293458c69c4ba3506289d0077042d
Author: Willy Goiffon <dev@z3bra.org>
Date:   Wed,  9 Oct 2019 11:30:09 +0200

Change formatting to avoid doubling newlines

Diffstat:
webdump.c | 23++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/webdump.c b/webdump.c @@ -538,17 +538,17 @@ xmltagend(XMLParser *p, const char *t, size_t tl, int isshort) // printf("DEBUG: end of tag: %s, %d, node tag: %s\n", t, cur->displaytype, cur->tag); if (cur->displaytype & DisplayBlock) { - fputs("\n", stdout); + ; } else if (cur->displaytype & DisplayPre) { - fputs("\n", stdout); - } else if (cur->displaytype & DisplayTable) { - fputs("\n", stdout); - } else if (cur->displaytype & DisplayTableRow) { - fputs(" | ", stdout); /* HACK: assume last cell */ + ; } else if (cur->displaytype & DisplayList) { - fputs("\n", stdout); + ; } else if (cur->displaytype & DisplayListItem) { + ; + } else if (cur->displaytype & DisplayTable) { fputs("\n", stdout); + } else if (cur->displaytype & DisplayTableRow) { + fputs("\n", stdout); // HACK: assume last cell } else if (cur->displaytype & DisplayHeader) { fputs("\n", stdout); if (tl == 2 && t[0] == 'h' && t[1] >= '1' && t[1] <= '6') { @@ -643,20 +643,21 @@ xmltagstartparsed(XMLParser *p, const char *t, size_t tl, int isshort) } else if (cur->displaytype & DisplayTableRow) { fputs("\n", stdout); } else if (cur->displaytype & DisplayTableCell) { - fputs(" | ", stdout); + fputs("\t", stdout); } else if (cur->displaytype & DisplayList) { - fputs("\n", stdout); + ; } else if (cur->displaytype & DisplayListItem) { /* indent nested list items */ + fputs("\n", stdout); for (i = curnode; i; i--) { if (nodes[i].displaytype & DisplayListItem) continue; if (nodes[i].displaytype & DisplayList) - fputs(" ", stdout); + fputs(" ", stdout); } /* TODO: for <ol>, keep list counter on ol element (parent), support ordered number type only */ - fputs("* ", stdout); + fputs("• ", stdout); } else if (!strcasecmp(t, "hr")) { /* ruler */ for (i = 0; i < termwidth; i++) putchar('-');