From 74184dd792fde977b7c55b159038ad0d8d7f3c7e Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 7 Jan 2025 15:06:26 +0100 Subject: Add CSS style for gemini pages --- Makefile | 4 ++++ gemini.filter.dpi | 11 ++++++----- style.css | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 style.css 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 "\n" if command -v ansi2html >/dev/null then ansi2html else cat @@ -36,9 +39,7 @@ render_gemini() { return str } BEGIN { - print "" + print "" } { 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\n", tag, html, tag + printf "<%s>%s\n", tag, html, tag next } /^>/ { @@ -117,7 +118,7 @@ render_gemini() { printf "
%s
\n", escape_html($0) } END { - print "" + print "" } ' } 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; +} -- cgit v1.2.3