diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2025-01-07 15:06:26 +0100 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2025-01-07 15:09:47 +0100 |
commit | 74184dd792fde977b7c55b159038ad0d8d7f3c7e (patch) | |
tree | cb0957dfd65977720df6cf25db72281eee9610a8 | |
parent | 92d425cd9093667c056706945bd33231664bbd5f (diff) |
Add CSS style for gemini pages
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x | gemini.filter.dpi | 11 | ||||
-rw-r--r-- | style.css | 16 |
3 files changed, 26 insertions, 5 deletions
@@ -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; +} |