URI: 
       tprint and reset each style (do not reset all attributes) - webdump - [FORK] git://git.codemadness.org/webdump
  HTML git clone git://git.z3bra.org/webdump.git
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 3ec685a587b8404367c9c0fc6e2ec6a8f1b40c77
   DIR parent 0b1fba4c2076d4f687ad03f7c6eb202acfece173
  HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Fri, 22 Nov 2019 13:12:04 +0100
       
       print and reset each style (do not reset all attributes)
       
       reset all attributes at the end (in case of invalid HTML).
       
       Diffstat:
         M webdump.c                           |      39 +++++++++++++++++++++----------
       
       1 file changed, 27 insertions(+), 12 deletions(-)
       ---
   DIR diff --git a/webdump.c b/webdump.c
       t@@ -99,7 +99,7 @@ static char src[4096]; /* src or href attribute */
        static String htmldata;
        
        /* for white-space output handling:
       -   1 = whitespace emitted (oppress repeated), 2 = other characters on this line
       +   1 = whitespace emitted (suppress repeated), 2 = other characters on this line
           Behaviour:
           * White-space data before non-whitespace data in tags are ignored on a line.
           * Repeated white-space are ignored: a single space (' ') is emitted.
       t@@ -590,9 +590,18 @@ xmltagend(XMLParser *p, const char *t, size_t tl, int isshort)
        //        printf("DEBUG: end of tag: %s, %d, node tag: %s\n", t,
        //               cur->tag.displaytype, cur->tagname);
        
       -        if (allowesc &&
       -            cur->tag.displaytype & (DisplayBold | DisplayItalic | DisplayUnderline))
       -                fputs("\033[0m", stdout); /* reset */
       +        if (cur->tag.displaytype & DisplayBold)
       +                printansi("\033[22m"); /* reset bold or faint */
       +        if (cur->tag.displaytype & DisplayItalic)
       +                printansi("\033[23m"); /* reset italic */
       +        if (cur->tag.displaytype & DisplayUnderline)
       +                printansi("\033[24m"); /* reset underline */
       +        if (cur->tag.displaytype & DisplayBlink)
       +                printansi("\033[25m"); /* reset blink */
       +        if (cur->tag.displaytype & DisplayReverse)
       +                printansi("\033[27m"); /* reset reverse */
       +        if (cur->tag.displaytype & DisplayStrike)
       +                printansi("\033[29m"); /* reset strike */
        
                if (cur->tag.displaytype & DisplayBlock) {
                        newline();
       t@@ -722,14 +731,18 @@ xmltagstartparsed(XMLParser *p, const char *t, size_t tl, int isshort)
                        }
                }
        
       -        if (allowesc) {
       -                if (cur->tag.displaytype & DisplayBold)
       -                        fputs("\033[1m", stdout);
       -                if (cur->tag.displaytype & DisplayItalic)
       -                        fputs("\033[3m", stdout);
       -                if (cur->tag.displaytype & DisplayUnderline)
       -                        fputs("\033[4m", stdout);
       -        }
       +        if (cur->tag.displaytype & DisplayBold)
       +                printansi("\033[1m");
       +        if (cur->tag.displaytype & DisplayItalic)
       +                printansi("\033[3m");
       +        if (cur->tag.displaytype & DisplayUnderline)
       +                printansi("\033[4m");
       +        if (cur->tag.displaytype & DisplayBlink)
       +                printansi("\033[5m");
       +        if (cur->tag.displaytype & DisplayReverse)
       +                printansi("\033[7m");
       +        if (cur->tag.displaytype & DisplayStrike)
       +                printansi("\033[9m");
        
                /* specific tag handling */
                if (!strcasecmp(t, "hr")) { /* ruler */
       t@@ -808,5 +821,7 @@ main(int argc, char **argv)
        #endif
                putchar('\n');
        
       +        printansi("\033[0m"); /* reset all attributes */
       +
                return 0;
        }