thide tags if parent is hidden - webdump - [FORK] git://git.codemadness.org/webdump
 (HTM) git clone git://git.z3bra.org/webdump.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit ea742c1140fa02bb5328c0c6f005c74150ec4c41
 (DIR) parent 2ef6d5a9e0fb526243121a4ac99f97f22ae6cd1a
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Tue, 10 Dec 2019 00:13:16 +0100
       
       hide tags if parent is hidden
       
       Diffstat:
         M webdump.c                           |      12 +++++++++---
       
       1 file changed, 9 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/webdump.c b/webdump.c
       t@@ -593,25 +593,31 @@ static void
        xmltagstart(XMLParser *x, const char *t, size_t tl)
        {
                struct tag *found;
       -        struct node *cur;
       +        struct node *cur, *parent;
        
                if (curnode >= MAX_DEPTH - 2)
                        errx(1, "max tag depth reached: %d\n", curnode);
       +        parent = &nodes[curnode];
                curnode++;
        
                cur = &nodes[curnode];
                memset(cur, 0, sizeof(*cur));
       +        /* tag defaults */
                cur->tag.displaytype = DisplayInline;
       +        cur->tag.name = cur->tagname;
                strlcpy(cur->tagname, t, sizeof(cur->tagname));
        
       -        src[0] = '\0'; /* src, href */
       -
                /* match tag */
                if ((found = findtag(t))) {
                        cur->nchildren = 0;
                        memcpy(&(cur->tag), found, sizeof(*found));
       +                /* parent tag is hidden, so hide ourself too */
       +                if (parent->tag.displaytype & DisplayNone)
       +                        cur->tag.displaytype |= DisplayNone;
                        return;
                }
       +
       +        src[0] = '\0'; /* reset src, href */
        }
        
        static void