From: Art Cancro Date: Mon, 25 Jan 2010 15:31:11 +0000 (+0000) Subject: * html2ascii now renders *bold* and /italic/ and _underlined_ text as shown here. X-Git-Tag: v7.86~479 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=b1640ee5883faaa54c4a1cc546b3a34255fbcd4c;p=citadel.git * html2ascii now renders *bold* and /italic/ and _underlined_ text as shown here. --- diff --git a/libcitadel/lib/html_to_ascii.c b/libcitadel/lib/html_to_ascii.c index e2cb2b77a..90d1103f5 100644 --- a/libcitadel/lib/html_to_ascii.c +++ b/libcitadel/lib/html_to_ascii.c @@ -2,8 +2,21 @@ * $Id: html.c 6014 2008-02-04 18:38:35Z ajc $ * * Functions which handle translation between HTML and plain text - * Copyright (c) 2000-2005 by Art Cancro and others. This program is - * released under the terms of the GNU General Public License. + * Copyright (c) 2000-2010 by the citadel.org team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include @@ -186,6 +199,34 @@ char *html_to_ascii(char *inputmsg, int msglen, int screenwidth, int do_citaform strcat(outbuf, nl); } + else if ( + (!strcasecmp(tag, "B")) + || (!strcasecmp(tag, "/B")) + || (!strcasecmp(tag, "STRONG")) + || (!strcasecmp(tag, "/STRONG")) + ) { + strcat(outbuf, "*"); + + } + + else if ( + (!strcasecmp(tag, "I")) + || (!strcasecmp(tag, "/I")) + || (!strcasecmp(tag, "EM")) + || (!strcasecmp(tag, "/EM")) + ) { + strcat(outbuf, "/"); + + } + + else if ( + (!strcasecmp(tag, "U")) + || (!strcasecmp(tag, "/U")) + ) { + strcat(outbuf, "_"); + + } + else if (!strcasecmp(tag, "BR")) { strcat(outbuf, nl); }