From dfaf5cc9043b8bce6f1edfd55a6bf696ce445052 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Thu, 23 Apr 2020 17:39:24 -0400 Subject: Wrap quoted lines in --- html.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'html.c') diff --git a/html.c b/html.c index 200032a..fe2f6db 100644 --- a/html.c +++ b/html.c @@ -204,11 +204,7 @@ static int htmlInlineAttrs(FILE *file, const struct BodyPart *part) { return 0; } -static bool isPatch(const char *content) { - return !strncmp(content, "---\n", 4) || strstr(content, "\n---\n"); -} - -static int htmlPatch(FILE *file, const char *content) { +static int htmlHighlight(FILE *file, const char *content) { int error = 0; size_t cap = 0; char *buf = NULL; @@ -245,6 +241,10 @@ static int htmlPatch(FILE *file, const char *content) { error = templateRender( file, TEMPLATE([line]), vars, escapeXML ); + } else if (buf[0] == '>') { + error = templateRender( + file, TEMPLATE([line]), vars, escapeXML + ); } else { error = escapeXML(file, buf); } @@ -255,17 +255,12 @@ static int htmlPatch(FILE *file, const char *content) { } int htmlInline(FILE *file, const struct BodyPart *part, const char *content) { - int error = 0 + return 0 || templateRender(file, TEMPLATE(), NULL, NULL); - if (error) return error; - if (isPatch(content)) { - error = htmlPatch(file, content); - } else { - error = escapeXML(file, content); - } - return error || templateRender(file, TEMPLATE(), NULL, NULL); + || templateRender(file, TEMPLATE(>), NULL, NULL) + || htmlHighlight(file, content) + || templateRender(file, TEMPLATE(), NULL, NULL); } int htmlAttachmentOpen(FILE *file) { -- cgit 1.4.1