summary refs log tree commit diff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/html.c b/html.c
index 1757fd9..25c9118 100644
--- a/html.c
+++ b/html.c
@@ -362,6 +362,24 @@ int htmlMessageClose(FILE *file) {
 	return templateRender(file, Q(</article>), NULL, NULL);
 }
 
+static int htmlStylesheet(FILE *file) {
+	if (baseStylesheet) {
+		const char *template = Q(<link rel="stylesheet" href="[href]">);
+		struct Variable vars[] = {
+			{ "href", baseStylesheet },
+			{0},
+		};
+		return templateRender(file, template, vars, escapeXML);
+	} else {
+		const char *template = Q(<style>[style]</style>);
+		struct Variable vars[] = {
+			{ "style", Stylesheet },
+			{0},
+		};
+		return templateRender(file, template, vars, NULL);
+	}
+}
+
 static char *htmlThreadURL(const struct Envelope *envelope, const char *type) {
 	struct Variable vars[] = {
 		{ "messageID", envelope->messageID },
@@ -381,6 +399,7 @@ int htmlThreadHead(FILE *file, const struct Envelope *envelope) {
 		<title>[subject]</title>
 		<link rel="alternate" type="application/atom+xml" href="[atom]">
 		<link rel="alternate" type="application/mbox" href="[mbox]">
+		<meta name="viewport" content="width=device-width, initial-scale=1.0">
 	);
 	struct Variable vars[] = {
 		{ "generator", GENERATOR_URL },
@@ -389,7 +408,9 @@ int htmlThreadHead(FILE *file, const struct Envelope *envelope) {
 		{ "mbox", mbox },
 		{0},
 	};
-	int error = templateRender(file, template, vars, escapeXML);
+	int error = 0
+		|| templateRender(file, template, vars, escapeXML)
+		|| htmlStylesheet(file);
 	free(atom);
 	free(mbox);
 	return error;
@@ -488,13 +509,16 @@ int htmlIndexHead(FILE *file) {
 		<meta name="generator" content="[generator]">
 		<title>[title]</title>
 		<link rel="alternate" type="application/atom+xml" href="index.atom">
+		<meta name="viewport" content="width=device-width, initial-scale=1.0">
 	);
 	struct Variable vars[] = {
 		{ "generator", GENERATOR_URL },
 		{ "title", baseTitle },
 		{0},
 	};
-	return templateRender(file, template, vars, escapeXML);
+	return 0
+		|| templateRender(file, template, vars, escapeXML)
+		|| htmlStylesheet(file);
 }
 
 int htmlIndexOpen(FILE *file) {
0400'>2022-03-18Publish "Addendum 2021"June McEnroe 2022-03-16Remove wcwidth portJune McEnroe DYLD_FORCE_FLAT_NAMESPACE no longer exists in macOS 12 so this approach doesn't work anymore. Moved to <https://git.causal.agency/jorts/tree/wcwidth> and compiled into <https://git.causal.agency/jorts/tree/ncurses>. 2022-03-16Remove -j4 from ./PlanJune McEnroe Plan learned to set this automatically! 2022-03-15Rewrite Linux install.sh for DebianJune McEnroe 2022-03-15Remove dashJune McEnroe