about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--html.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/html.c b/html.c
index 5104667..981dc4c 100644
--- a/html.c
+++ b/html.c
@@ -91,14 +91,6 @@ htmlAddressList(FILE *file, const char *name, struct AddressList list) {
 	return templateRender(file, Q(</div>), NULL, NULL);
 }
 
-static char *htmlFragment(const char *messageID) {
-	struct Variable vars[] = {
-		{ "messageID", messageID },
-		{0},
-	};
-	return templateString("#[messageID]", vars, escapeURL);
-}
-
 static char *htmlMbox(const char *messageID) {
 	struct Variable vars[] = {
 		{ "messageID", messageID },
@@ -155,40 +147,35 @@ static char *htmlReply(const struct Envelope *envelope) {
 }
 
 int htmlMessageNav(FILE *file, const struct Envelope *envelope) {
-	char *parent = envelope->inReplyTo
-		? htmlFragment(envelope->inReplyTo)
-		: NULL;
 	char *mbox = htmlMbox(envelope->messageID);
 	char *reply = htmlReply(envelope);
 	const char *template = Q(
 		<nav>
 			[+parent]
-			<a href="[parent]">parent</a>
+			<a href="#[parent]">parent</a>
 			[-]
 			<a href="[mbox]">download</a>
 			<a href="[reply]">reply</a>
 		</nav>
 	);
 	struct Variable vars[] = {
-		{ "parent", parent },
+		{ "parent", envelope->inReplyTo },
 		{ "mbox", mbox },
 		{ "reply", reply },
 		{0},
 	};
 	int error = templateRender(file, template, vars, escapeXML);
-	free(parent);
 	free(mbox);
 	free(reply);
 	return error;
 }
 
 int htmlMessageOpen(FILE *file, const struct Envelope *envelope, bool nested) {
-	char *fragment = htmlFragment(envelope->messageID);
 	char *mailto = htmlMailto(envelope->from);
 	const char *template = Q(
 		<article class="message" id="[messageID]">
 		<header>
-			<h2 class="Subject"><a href="[fragment]">[subject]</a></h2>
+			<h2 class="Subject"><a href="#[messageID]">[subject]</a></h2>
 			<div class="From">
 				From: <a href="[mailto]">[from]</a>
 				<time datetime="[utc]">[date]</time>
@@ -196,7 +183,6 @@ int htmlMessageOpen(FILE *file, const struct Envelope *envelope, bool nested) {
 	);
 	struct Variable vars[] = {
 		{ "messageID", envelope->messageID },
-		{ "fragment", fragment },
 		{ "subject", envelope->subject },
 		{ "mailto", mailto },
 		{ "from", addressName(envelope->from) },
@@ -210,7 +196,6 @@ int htmlMessageOpen(FILE *file, const struct Envelope *envelope, bool nested) {
 		|| htmlAddressList(file, "Cc", envelope->cc)
 		|| (nested ? 0 : htmlMessageNav(file, envelope))
 		|| templateRender(file, Q(</header>), NULL, NULL);
-	free(fragment);
 	free(mailto);
 	return error;
 }