When converting HTML to plain text, omit any text
authorArt Cancro <ajc@citadel.org>
Thu, 19 Apr 2007 15:27:40 +0000 (15:27 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 19 Apr 2007 15:27:40 +0000 (15:27 +0000)
that appears between <style> </style> tags.

citadel/html.c

index a0d2e112c3e8525359667c039c30e71ec41e0607..3964dade2a6ab6f8f7cb502ed37b5ba5ca24137e 100644 (file)
@@ -60,6 +60,8 @@ char *html_to_ascii(char *inputmsg, int msglen, int screenwidth, int do_citaform
        int i, j, ch, did_out, rb, scanch;
        int nest = 0;           /* Bracket nesting level */
        int blockquote = 0;     /* BLOCKQUOTE nesting level */
+       int styletag = 0;       /* STYLE tag nesting level */
+       int styletag_start = 0;
        int bytes_processed = 0;
        char nl[128];
 
@@ -221,6 +223,20 @@ char *html_to_ascii(char *inputmsg, int msglen, int screenwidth, int do_citaform
                                        strcat(outbuf, nl);
                                }
 
+                               else if (!strcasecmp(tag, "STYLE")) {
+                                       ++styletag;
+                                       if (styletag == 1) {
+                                               styletag_start = strlen(outbuf);
+                                       }
+                               }
+
+                               else if (!strcasecmp(tag, "/STYLE")) {
+                                       --styletag;
+                                       if (styletag == 0) {
+                                               outbuf[styletag_start] = 0;
+                                       }
+                               }
+
                        }
 
                        else if ((nest > 0) && (strlen(tag)<(sizeof(tag)-1))) {