From 274c95e13b3868d29c4790a4603f27c0a04616aa Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 21 Sep 2022 19:13:45 -0400 Subject: [PATCH] Tried to add a few style thingies back into the renderer --- libcitadel/lib/html_to_ascii.c | 42 ++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/libcitadel/lib/html_to_ascii.c b/libcitadel/lib/html_to_ascii.c index 2d604ac4f..33373c19d 100644 --- a/libcitadel/lib/html_to_ascii.c +++ b/libcitadel/lib/html_to_ascii.c @@ -185,34 +185,52 @@ char *html_to_ascii(const char *inputmsg, int msglen, int screenwidth, int ansi) strcat(outbuf, nl); } -#if 0 - These seemed like a good idea at the time, but it just makes a mess. - else if ( (!strcasecmp(tag, "B")) - || (!strcasecmp(tag, "/B")) || (!strcasecmp(tag, "STRONG")) + ) { + if (ansi) { + strcat(outbuf, "\033[1m"); + } + } + else if ( + (!strcasecmp(tag, "/B")) || (!strcasecmp(tag, "/STRONG")) ) { - strcat(outbuf, "*"); + if (ansi) { + strcat(outbuf, "\033[22m"); + } } else if ( (!strcasecmp(tag, "I")) - || (!strcasecmp(tag, "/I")) || (!strcasecmp(tag, "EM")) - || (!strcasecmp(tag, "/EM")) ) { - strcat(outbuf, "/"); + if (ansi) { + strcat(outbuf, "\033[3m"); + } } else if ( - (!strcasecmp(tag, "U")) - || (!strcasecmp(tag, "/U")) + (!strcasecmp(tag, "/I")) + || (!strcasecmp(tag, "/EM")) ) { - strcat(outbuf, "_"); + if (ansi) { + strcat(outbuf, "\033[23m"); + } + } + + else if (!strcasecmp(tag, "U")) { + if (ansi) { + strcat(outbuf, "\033[4m"); + } + } + + else if (!strcasecmp(tag, "/U")) { + if (ansi) { + strcat(outbuf, "\033[24m"); + } } -#endif else if (!strcasecmp(tag, "BR")) { strcat(outbuf, nl); -- 2.30.2