summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-12 11:18:06 -0400
committerJune McEnroe <june@causal.agency>2020-04-12 11:20:31 -0400
commita105ca383bfd94eade07f957a6c9df3dc60de3f8 (patch)
tree53bc33a59d0447ae011cf1ec3e79f5413edbf63b
parentUse Message-Id in mailto Atom IDs (diff)
downloadbubger-a105ca383bfd94eade07f957a6c9df3dc60de3f8.tar.gz
bubger-a105ca383bfd94eade07f957a6c9df3dc60de3f8.zip
Do not use <h1> for subject lines
-rw-r--r--archive.h3
-rw-r--r--export.c3
-rw-r--r--html.c9
3 files changed, 11 insertions, 4 deletions
diff --git a/archive.h b/archive.h
index bcadb70..85428fe 100644
--- a/archive.h
+++ b/archive.h
@@ -99,7 +99,8 @@ int mboxFrom(FILE *file);
 int mboxHeader(FILE *file, char *header);
 int mboxBody(FILE *file, char *body);
 
-int htmlEnvelope(FILE *file, const struct Envelope *envelope);
+int htmlMessageHead(FILE *file, const struct Envelope *envelope);
+int htmlMessageTail(FILE *file);
 
 int atomEntryHead(FILE *file, const struct Envelope *envelope);
 int atomEntryTail(FILE *file);
diff --git a/export.c b/export.c
index dcd6b18..0f35602 100644
--- a/export.c
+++ b/export.c
@@ -127,7 +127,8 @@ void exportData(struct List items) {
 	path = uidPath(uid, "html");
 	file = fopen(path, "w");
 	if (!file) err(EX_CANTCREAT, "%s", path);
-	error = htmlEnvelope(file, &envelope)
+	error = htmlMessageHead(file, &envelope)
+		|| htmlMessageTail(file)
 		|| fclose(file);
 	if (error) err(EX_IOERR, "%s", path);
 
diff --git a/html.c b/html.c
index 14a4be9..ac1411d 100644
--- a/html.c
+++ b/html.c
@@ -51,7 +51,7 @@ htmlAddressList(FILE *file, const char *class, struct AddressList list) {
 	return templateRender(file, TEMPLATE(</ul>), vars, escapeXML);
 }
 
-int htmlEnvelope(FILE *file, const struct Envelope *envelope) {
+int htmlMessageHead(FILE *file, const struct Envelope *envelope) {
 	struct Variable urlVars[] = {
 		{ "mailbox", envelope->replyTo.mailbox },
 		{ "host", envelope->replyTo.host },
@@ -85,7 +85,7 @@ int htmlEnvelope(FILE *file, const struct Envelope *envelope) {
 	const char *Summary = TEMPLATE(
 		<details class="message" id="[messageID]">
 		<summary>
-			<h1 class="subject"><a href="[fragment]">[subject]</a></h1>
+			<a class="subject" href="[fragment]">[subject]</a>
 			<address class="from"><a href="[mailto]">[from]</a></address>
 			<time datetime="[utc]">[date]</time>
 			<a class="mbox" href="[mbox]">mbox</a>
@@ -101,3 +101,8 @@ int htmlEnvelope(FILE *file, const struct Envelope *envelope) {
 		|| htmlAddressList(file, "to", envelope->to)
 		|| htmlAddressList(file, "cc", envelope->cc);
 }
+
+int htmlMessageTail(FILE *file) {
+	int n = fprintf(file, "</details>\n");
+	return (n < 0 ? n : 0);
+}