summary refs log tree commit diff
path: root/html.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-07-10 09:05:32 -0400
committerJune McEnroe <june@causal.agency>2020-07-10 09:05:32 -0400
commitc991c534ef92adf254196fd09775ebb08ce2198d (patch)
tree8c59c325278680d87b9fd4b1176eadfbf021586f /html.c
parentList active networks first (diff)
downloadscooper-c991c534ef92adf254196fd09775ebb08ce2198d.tar.gz
scooper-c991c534ef92adf254196fd09775ebb08ce2198d.zip
Add default stylesheet
Diffstat (limited to 'html.c')
-rw-r--r--html.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/html.c b/html.c
index 9d9134b..c6b4a42 100644
--- a/html.c
+++ b/html.c
@@ -21,16 +21,26 @@
 
 #include "server.h"
 
+static const char DefaultStyle[] = {
+#include "default.css.h"
+	,'\0'
+};
+
 const char *htmlStylesheet;
 
 static enum kcgi_err stylesheet(struct khtmlreq *html) {
-	if (!htmlStylesheet) return KCGI_OK;
-	return khtml_attr(
-		html, KELEM_LINK,
-		KATTR_REL, "stylesheet",
-		KATTR_HREF, htmlStylesheet,
-		KATTR__MAX
-	);
+	if (htmlStylesheet) {
+		return khtml_attr(
+			html, KELEM_LINK,
+			KATTR_REL, "stylesheet",
+			KATTR_HREF, htmlStylesheet,
+			KATTR__MAX
+		);
+	}
+	return 0
+		|| khtml_elem(html, KELEM_STYLE)
+		|| khtml_puts(html, DefaultStyle)
+		|| khtml_closeelem(html, 1);
 }
 
 enum kcgi_err htmlHead(struct khtmlreq *html, const char *title) {