commit 3b5a679c0f17fcb313ff334060fb897129ec6ff2
parent 3fbde7215002ef3f8d7b99fcd246b9f227731663
Author: aabacchus <ben@bvnf.space>
Date: Sun, 22 Aug 2021 05:46:41 +0100
blog: add index
Diffstat:
6 files changed, 66 insertions(+), 3 deletions(-)
diff --git a/blog/.gitignore b/blog/.gitignore
@@ -1 +1,2 @@
*.txt
+index.html
diff --git a/blog/001-this-server.7 b/blog/001-this-server.7
@@ -99,4 +99,3 @@ source available from
\&.
.Sh AUTHORS
.An phoebos Aq Mt ben@bvnf.space
-.El
diff --git a/blog/Makefile b/blog/Makefile
@@ -1,11 +1,14 @@
TXTS += 001-this-server.txt
-all: ${TXTS}
+all: ${TXTS} index.html
.SUFFIXES: .7 .txt
.7.txt:
mandoc -Tascii $< | col -bx > $@
+index.html:
+ ./gen-index.sh
+
clean:
- rm -f ${TXTS}
+ rm -f ${TXTS} index.html
diff --git a/blog/gen-index.sh b/blog/gen-index.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# some of this was taken from june's feed.sh
+# (https://git.causal.agency/src/plain/www/text.causal.agency/feed.sh)
+
+exec > "${1:-index.html}"
+
+cat << EOF
+<!DOCTYPE html>
+<html lang=en>
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" >
+ <title>ben's blog</title>
+ <link rel="stylesheet" href="../style.css" type="text/css">
+</head>
+<body>
+ <header><nav>
+ <a href="/">[Home]</a>
+ <a>[Blog]</a>
+ <a href="https://git.bvnf.space/">[Git]</a>
+ </nav></header>
+ <table>
+EOF
+
+for txt in *.txt ; do
+ in="${txt%.txt}.7"
+ date="$(grep '^[.]Dd' "$in" | cut -c 5-)"
+ title="$(grep '^[.]Nm' "$in" | cut -c 5-)"
+ desc="$(grep '^[.]Nd' "$in" | cut -c 5-)"
+
+ cat <<EOF
+ <tr>
+ <td align="left" class="index-post">
+ <a href="$txt">$title</a> - $desc
+ </td>
+ <td align="right" class="index-date">$date</td>
+ </tr>
+EOF
+
+done
+
+cat << EOF
+</table>
+</body>
+</html>
+EOF
diff --git a/index.html b/index.html
@@ -9,6 +9,7 @@
<body>
<header><nav>
<a>[Home]</a>
+ <a href="/blog">[Blog]</a>
<a href="https://git.bvnf.space/">[Git]</a>
</nav></header>
<h1>Hello, world</h1>
diff --git a/style.css b/style.css
@@ -1,5 +1,17 @@
body {
font-family: monospace;
font-size: 18px;
+ padding: 0 0.7em;
+ margin: 1em auto;
+ max-width: 800px;
+ color: #444;
+ background: #eeeeee;
}
code { font-family: monospace }
+table {
+ width: 100%;
+}
+
+.index-post, .index-date {
+ padding-top: 20px;
+}