summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--html.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/html.c b/html.c
index 4269871..95afe4d 100644
--- a/html.c
+++ b/html.c
@@ -147,31 +147,37 @@ htmlNavItem(FILE *file, const char *name, const char *base, const char *url) {
 	return templateRender(file, template, vars, escapeXML);
 }
 
+static int htmlParent(FILE *file, const struct Envelope *envelope) {
+	if (!envelope->inReplyTo) return 0;
+	char *fragment = htmlFragment(envelope->inReplyTo);
+	int error = htmlNavItem(file, "parent", "", fragment);
+	free(fragment);
+	return error;
+}
+
 int htmlMessageNav(FILE *file, const struct Envelope *envelope) {
 	char *mbox = htmlMbox(envelope->messageID);
+	char *reply = htmlReply(envelope);
 	int error = 0
 		|| templateRender(file, Q(<nav><ul>), NULL, NULL)
-		|| htmlNavItem(file, "download", "", mbox);
-	if (error) return error;
+		|| htmlParent(file, envelope)
+		|| htmlNavItem(file, "download", "", mbox)
+		|| htmlNavItem(file, "reply", "", reply)
+		|| templateRender(file, Q(</ul></nav>), NULL, NULL);
 	free(mbox);
-	if (envelope->inReplyTo) {
-		char *fragment = htmlFragment(envelope->inReplyTo);
-		error = htmlNavItem(file, "parent", "", fragment);
-		free(fragment);
-		if (error) return error;
-	}
-	return templateRender(file, Q(</ul></nav>), NULL, NULL);
+	free(reply);
+	return error;
 }
 
 int htmlMessageOpen(FILE *file, const struct Envelope *envelope) {
 	char *fragment = htmlFragment(envelope->messageID);
-	char *reply = htmlReply(envelope);
+	char *mailto = htmlMailto(envelope->from);
 	const char *template = Q(
 		<article class="message" id="[messageID]">
 		<header>
 			<h2 class="Subject"><a href="[fragment]">[subject]</a></h2>
 			<div class="From">
-				From: <a href="[reply]">[from]</a>
+				From: <a href="[mailto]">[from]</a>
 				<time datetime="[utc]">[date]</time>
 			</div>
 	);
@@ -179,7 +185,7 @@ int htmlMessageOpen(FILE *file, const struct Envelope *envelope) {
 		{ "messageID", envelope->messageID },
 		{ "fragment", fragment },
 		{ "subject", envelope->subject },
-		{ "reply", reply },
+		{ "mailto", mailto },
 		{ "from", addressName(envelope->from) },
 		{ "utc", iso8601(envelope->time).s },
 		{ "date", envelope->date },
@@ -192,7 +198,7 @@ int htmlMessageOpen(FILE *file, const struct Envelope *envelope) {
 		|| htmlMessageNav(file, envelope)
 		|| templateRender(file, Q(</header>), NULL, NULL);
 	free(fragment);
-	free(reply);
+	free(mailto);
 	return error;
 }
 
4fda0dc6b4f6&follow=1'>Add downgrade IRC botJune McEnroe 2021-09-14Sort by title if authors matchJune McEnroe There are probably better things to sort by but title definitely always exists. 2021-09-13Swap-remove tags as they're foundJune McEnroe This makes it even faster. From ~1s on a sqlite3.c amalgamation to ~0.85s. 2021-09-12Replace htagml regex with strncmpJune McEnroe Since ctags only ever produces regular expressions of the form /^re$/ or /^re/ with no other special characters, instead unescape the pattern and simply use strncmp. Running on a sqlite3.c amalgamation, the regex version takes ~37s while the strncmp version takes ~1s, producing identical output. Big win! 2021-09-11Also defer printing comment for lone close-parensJune McEnroe 2021-09-10Publish "git-comment"June McEnroe 2021-09-10Add git comment --pretty optionJune McEnroe 2021-09-08Defer printing comment if line is blank or closing braceJune McEnroe This fixes badly indented comments. 2021-09-08Up default min-repeat to 30 linesJune McEnroe 2021-09-08Handle dirty lines in git-commentJune McEnroe 2021-09-08Document and install git-commentJune McEnroe 2021-09-08Add repeat and all options to git-commentJune McEnroe 2021-09-08Add group threshold to git-commentJune McEnroe