"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
got-www: generate HTML page from CHANGES
To:
gameoftrees@openbsd.org
Date:
Sun, 27 Oct 2024 18:21:10 +0100

Download raw body.

Thread
Just an idea.  It's easier to read the changelog on a web browser this
way, and we could even link the changes for a specific release?

Here's a preview: https://tmp.omarpolo.com/changes.html

If ok I'll commit the generated releases/changes.html as well.

Thoughs?  Do we need something similar for -portable too? =)

diff /home/op/w/got-www
commit - 2fa5e3a8004ff7eea62475253244dec9567b245f
path + /home/op/w/got-www
blob - /dev/null
file + sync-changes.sh (mode 755)
--- /dev/null
+++ sync-changes.sh
@@ -0,0 +1,94 @@
+#!/bin/sh
+
+exec >releases/changes.html
+
+cat <<EOF
+<!doctype html>
+<html lang="en">
+<head>
+  <meta charset=utf-8 />
+  <title>Game of Trees Changes</title>
+  <meta name="description" content="Game of Trees Changelog" />
+  <meta name="viewport" content="width=device-width, initial-scale=1" />
+  <link rel="stylesheet" type="text/css" href="/openbsd.css" />
+  <link rel="canonical" href="https://gameoftrees.org/releases/changes.html" />
+</head>
+<body>
+
+<h2>
+<a href="/"><i>Game of Trees</i></a>
+Changes
+</h2>
+<hr />
+
+<p>
+See git repository history for per-change authorship information
+</p>
+
+EOF
+
+awk '
+// {
+	sub("^ +", "")
+	sub(" +$", "")
+}
+/^\*/ {
+	if (change != "") {
+		emit(change)
+		print("</ul>")
+	}
+	if (insublist) {
+		insublist = 0
+		print("</ul>")
+	}
+	sub(";", "", $3)
+	version = $3
+	date = $4
+	printf("<h3 id=\"%s\"><a href=\"#%s\">%s; %s</a></h3>\n", date, date, version, date)
+	print("<ul>")
+	next
+}
+/^$/ { next }
+/see git repository history for per-change authorship/ { next }
+/^-/ {
+	if (change != "")
+		emit(change)
+	if (insublist) {
+		insublist = 0
+		print("</ul>")
+	}
+	sub("^- *", "", $0)
+	change = $0
+	next
+}
+/^o / {
+	if (change != "")
+		emit(change)
+	if (!insublist) {
+		insublist = 1
+		print("<ul>")
+	}
+	sub("^o +", "", $0)
+	change = $0
+	next
+}
+// { change = sprintf("%s %s", change, $0) }
+END {
+	if (change != "")
+		emit(change)
+}
+function san(s) {
+	gsub("&", "\\&amp;", s)
+	gsub("<", "\\&lt;", s)
+	gsub(">", "\\&gt;", s)
+	return s
+}
+function emit(s) {
+	if (s == "")
+		return
+	print("<li>")
+	print(san(s))
+	print("</li>")
+	change = ""
+}
+' < releases/CHANGES