summary refs log tree commit diff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/html.c b/html.c
index 677bed0..b977137 100644
--- a/html.c
+++ b/html.c
@@ -144,6 +144,27 @@ int htmlMessageOpen(FILE *file, const struct Envelope *envelope) {
 	return error;
 }
 
+int htmlInlineOpen(FILE *file, const struct BodyPart *part) {
+	// TODO: Include Content-Id as id?
+	const char *template = TEMPLATE(
+		<pre lang="[lang]">
+	);
+	const char *lang = "";
+	// FIXME: part->language should be more structured.
+	if (part->language.len && part->language.ptr[0].type == String) {
+		lang = part->language.ptr[0].string;
+	}
+	struct Variable vars[] = {
+		{ "lang", lang },
+		{0},
+	};
+	return templateRender(file, template, vars, escapeXML);
+}
+
+int htmlInlineClose(FILE *file) {
+	return templateRender(file, TEMPLATE(</pre>), NULL, NULL);
+}
+
 int htmlMessageClose(FILE *file) {
 	return templateRender(file, TEMPLATE(</article>), NULL, NULL);
 }