aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rwxr-xr-xgemini.filter.dpi11
-rw-r--r--style.css16
3 files changed, 26 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 51036ae..1ff7047 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
NAME = gemini
BIN = $(NAME).filter.dpi
DILLO_DIR = ~/.dillo
+CSS = style.css
DPI_DIR = $(DILLO_DIR)/dpi/$(NAME)
DPIDRC = $(DILLO_DIR)/dpidrc
@@ -21,13 +22,16 @@ install-proto: $(DPIDRC)
link: $(BIN) install-proto
mkdir -p $(DPI_DIR)
ln -frs $(BIN) $(DPI_DIR)
+ ln -frs $(CSS) $(DPI_DIR)
install: $(BIN) install-proto
mkdir -p $(DPI_DIR)
cp -f $(BIN) $(DPI_DIR)
+ cp -f $(CSS) $(DPI_DIR)
uninstall: $(BIN)
rm -f $(DPI_DIR)/$(BIN)
+ rm -f $(DPI_DIR)/$(CSS)
.PHONY:
all install install-proto uninstall
diff --git a/gemini.filter.dpi b/gemini.filter.dpi
index 44059d6..cb3e55f 100755
--- a/gemini.filter.dpi
+++ b/gemini.filter.dpi
@@ -25,6 +25,9 @@ serve_404() {
render_gemini() {
printf "Content-type: text/html\r\n\r\n"
+ printf "<!doctype html><html><head><style>\n"
+ cat ~/.dillo/dpi/gemini/style.css || true
+ printf "</style></head>\n"
if command -v ansi2html >/dev/null
then ansi2html
else cat
@@ -36,9 +39,7 @@ render_gemini() {
return str
}
BEGIN {
- print "<!doctype html><body><style>"\
- "h1, h2, h3 { margin: 0; }\n"\
- "</style>"
+ print "<body>"
}
{
sub(/\r$/, "")
@@ -77,7 +78,7 @@ render_gemini() {
match($0, /^(#+[ \t]*)/)
text = substr($0, RLENGTH+1)
html = escape_html(text)
- printf "<%s style=\"font:sans-serif\">%s</%s>\n", tag, html, tag
+ printf "<%s>%s</%s>\n", tag, html, tag
next
}
/^>/ {
@@ -117,7 +118,7 @@ render_gemini() {
printf "<div>%s</div>\n", escape_html($0)
}
END {
- print "</body>"
+ print "</body></html>"
}
'
}
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..004dd59
--- /dev/null
+++ b/style.css
@@ -0,0 +1,16 @@
+body {
+ width: 64ch;
+ margin: 3em;
+ font-size: 16px;
+ line-height: 1.4em;
+}
+
+pre {
+ padding: 1em;
+ font-size: 14px;
+ margin-bottom: 0.5em;
+}
+
+h1,h2,h3,h4,h5,h6 {
+ line-height: 1.5em;
+}