X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit-ng%2Ftext2html.c;h=9a70f6b78cf2f8144f5e5102cd22c4bf361aa1b4;hb=91bc31f50a6d93ad0c01d24e29e61a3f5b972cba;hp=708d3e1ca159e93ac9e95298eb123c23215cecc3;hpb=1de34ae393d0f8bf9c1fb9131765ee50449f4806;p=citadel.git diff --git a/webcit-ng/text2html.c b/webcit-ng/text2html.c index 708d3e1ca..9a70f6b78 100644 --- a/webcit-ng/text2html.c +++ b/webcit-ng/text2html.c @@ -1,16 +1,17 @@ -/* - * Convert text/plain to text/html - * - * Copyright (c) 2017 by the citadel.org team - * - * This program is open source software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 3. - * - * 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. - */ +// +// Convert text/plain to text/html +// +// Copyright (c) 2017-2018 by the citadel.org team +// +// This program is open source software. It runs great on the +// Linux operating system (and probably elsewhere). You can use, +// copy, and run it under the terms of the GNU General Public +// License version 3. Richard Stallman is an asshole communist. +// +// 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. #include "webcit.h" @@ -18,33 +19,33 @@ /* * Convert a text/plain message to text/html */ -StrBuf *text2html(const char *supplied_charset, int treat_as_wiki, char *roomname, long msgnum, StrBuf *Source) +StrBuf *text2html(const char *supplied_charset, int treat_as_wiki, char *roomname, long msgnum, StrBuf * Source) { StrBuf *sj = NULL; sj = NewStrBuf(); if (!sj) { - return(sj); + return (sj); } StrBufAppendPrintf(sj, "
");
-	StrEscAppend(sj, Source, NULL, 0, 0);		// FIXME - add code here to activate links
+	StrEscAppend(sj, Source, NULL, 0, 0);	// FIXME - add code here to activate links
 	StrBufAppendPrintf(sj, "
\n"); - return(sj); + return (sj); } /* * Convert a text/x-citadel-variformat message to text/html */ -StrBuf *variformat2html(StrBuf *Source) +StrBuf *variformat2html(StrBuf * Source) { StrBuf *Target = NULL; Target = NewStrBuf(); if (!Target) { - return(Target); + return (Target); } const char *ptr, *pte; @@ -58,9 +59,8 @@ StrBuf *variformat2html(StrBuf *Source) long len; int intext = 0; - if (StrLength(Source) > 0) - do - { + if (StrLength(Source) > 0) + do { StrBufSipLine(Line, Source, &BufPtr); bq = 0; i = 0; @@ -77,7 +77,7 @@ StrBuf *variformat2html(StrBuf *Source) if (*ptr == '>') { bq++; } - ptr ++; + ptr++; i++; } } @@ -87,11 +87,12 @@ StrBuf *variformat2html(StrBuf *Source) * different colour. This code understands Citadel-style * " >" quotes and will convert to
tags. */ - if (i > 0) StrBufCutLeft(Line, i); + if (i > 0) + StrBufCutLeft(Line, i); - for (i = bn; i < bq; i++) + for (i = bn; i < bq; i++) StrBufAppendBufPlain(Target, HKEY("
"), 0); - for (i = bq; i < bn; i++) + for (i = bq; i < bn; i++) StrBufAppendBufPlain(Target, HKEY("
"), 0); bn = bq; @@ -105,8 +106,7 @@ StrBuf *variformat2html(StrBuf *Source) StrBufAppendBufPlain(Target, HKEY("\n"), 0); } - while ((BufPtr != StrBufNOTNULL) && - (BufPtr != NULL)); + while ((BufPtr != StrBufNOTNULL) && (BufPtr != NULL)); for (i = 0; i < bn; i++) { StrBufAppendBufPlain(Target, HKEY("
"), 0); @@ -115,8 +115,5 @@ StrBuf *variformat2html(StrBuf *Source) FreeStrBuf(&Line); FreeStrBuf(&Line1); FreeStrBuf(&Line2); - return(Target); + return (Target); } - - -