summary refs log tree commit diff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c23
1 files changed, 9 insertions, 14 deletions
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(<ins>[line]</ins>), vars, escapeXML
 			);
+		} else if (buf[0] == '>') {
+			error = templateRender(
+				file, TEMPLATE(<q>[line]</q>), 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(<pre), NULL, NULL)
 		|| htmlInlineAttrs(file, part)
-		|| 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(</pre>), NULL, NULL);
+		|| templateRender(file, TEMPLATE(>), NULL, NULL)
+		|| htmlHighlight(file, content)
+		|| templateRender(file, TEMPLATE(</pre>), NULL, NULL);
 }
 
 int htmlAttachmentOpen(FILE *file) {