diff options
author | Adam Stück <adam@adast.dk> | 2024-08-13 08:31:02 +0200 |
---|---|---|
committer | Adam Stück <adam@adast.dk> | 2024-08-13 08:31:02 +0200 |
commit | 915413b54a12f13f099422b06d30aed78b089d98 (patch) | |
tree | 4571a5732b1d4c9371eeb3a3c96d95c7b7e0deb9 | |
parent | 827ede036eb80b6c279bc034f56607fa77435693 (diff) |
Update barf and styling
-rwxr-xr-x | barf | 61 | ||||
-rw-r--r-- | footer.html | 12 | ||||
-rw-r--r-- | header.html | 32 | ||||
-rw-r--r-- | index.md | 14 |
4 files changed, 87 insertions, 32 deletions
@@ -1,4 +1,19 @@ #!/bin/sh + +domain="https://arena.adast.dk" + +# Check the operating system +os_name=$(uname -s) + +if [ "$os_name" = "OpenBSD" ]; then + alias sed=gsed + alias date=gdate + alias rsync=openrsync +elif [ "$os_name" = "Darwin" ]; then + alias sed=gsed + alias date=gdate +fi + set -eu MARKDOWN=smu IFS=' ' @@ -20,13 +35,13 @@ index_html() { # Intro text $MARKDOWN index.md - echo "<ul>" + echo '<ul class="posts">' # Posts while read -r f title created; do - link=$(echo "$f" | sed -E 's|.*/(.*).md|\1/|') + link=$(echo "$f" | sed -E 's|.*/(.*).md|/\1|') created=$(echo $(head -3 "$f" | tail -1)) - echo "<li>$created · <a href=\"$link\">$title</a></li>" + echo "<li><span>$created</span><a href=\"$link\">$title</a></li>" done < "$1" | sort -r echo "</ul>" @@ -37,7 +52,6 @@ index_html() { atom_xml() { uri=$(sed -rn '/atom.xml/ s/.*href="([^"]*)".*/\1/ p' header.html) - domain=$(echo "$uri" | sed 's/atom.xml//g' | sed 's|/[^/]*$||') first_commit_date=$(git log --pretty='format:%ai' . | cut -d ' ' -f1 | tail -1) cat <<EOF @@ -74,6 +88,44 @@ EOF echo '</feed>' } +rss_xml() { + uri=$(sed -rn '/rss.xml/ s/.*href="([^"]*)".*/\1/ p' header.html) + first_commit_date=$(git log --pretty='format:%ai' . | cut -d ' ' -f1 | tail -1) + + cat <<EOF +<?xml version="1.0" encoding="utf-8"?> +<rss version="2.0"> + <channel> + <title>$(sed -n '/^# /{s/# //p; q}' index.md)</title> + <link>$domain/rss.xml</link> + <description>Adam Stück's blog</description> + <lastBuildDate>$(date -u +"%a, %d %b %Y %H:%M:%S %z")</lastBuildDate> + <pubDate>$(date -u +"%a, %d %b %Y %H:%M:%S %z")</pubDate> + <generator>Custom RSS Generator</generator> + <ttl>1800</ttl> +EOF + + while read -r f title created; do + content=$($MARKDOWN "$f" | sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g') + post_link=$(echo "$f" | sed -E 's|posts/(.*).md|\1|') + basic_date=$(echo $(head -3 "$f" | tail -1)) + published_date=$(date -d "$basic_date" -u +"%a, %d %b %Y %H:%M:%S %z") + + cat <<EOF + <item> + <title>$title</title> + <description>$content</description> + <link>$domain/$post_link</link> + <guid isPermaLink="false">$domain/$post_link</guid> + <pubDate>$published_date</pubDate> + </item> +EOF + done < "$1" + + echo '</channel>' + echo '</rss>' +} + write_page() { filename=$1 directory=$(echo $(basename "$filename" .md)) @@ -94,6 +146,7 @@ rm -rf build && mkdir build index_tsv posts | sort -rt " " -k 3 > build/posts.tsv index_html build/posts.tsv > build/index.html atom_xml build/posts.tsv > build/atom.xml +rss_xml build/posts.tsv > build/rss.xml while read -r f title created; do write_page "$f" "$title" "$created" done < build/posts.tsv diff --git a/footer.html b/footer.html index 5e1c1d3..14eff0a 100644 --- a/footer.html +++ b/footer.html @@ -1,16 +1,14 @@ +<hr/> <footer role="contentinfo"> - <hr> - <h3 id="menu">Menu Navigation</h3> + <h2>Menu Navigation</h2> <ul> <li><a href="/">Home</a></li> <li><a href="https://tv.adast.dk/c/arena/videos">Videos</a></li> - <li><a href="/atom.xml">RSS</a></li> - <li><a href="#top">↑ Top of the page</a></li> + <li><a href="#top">↑ Top of the page</a></li> </ul> <small> - Built with <a href="https://git.btxx.org/barf">barf</a>. <br> - Maintained with ♥ for the web. <br> - The content for this site is <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC-BY-SA</a>.<br> + Feeds: <a href="/atom.xml">Atom</a> | <a href="/rss.xml">RSS</a> <br> + Built with <a href="https://barf.btxx.org">barf</a>. <br> The <a href="https://git.sr.ht/~adamski/arena-web">code for this site</a> is <a href="https://git.sr.ht/~adamski/arena-web/tree/main/item/LICENSE">MIT</a>. </small> </footer> diff --git a/header.html b/header.html index be7f525..b687008 100644 --- a/header.html +++ b/header.html @@ -1,17 +1,21 @@ <!doctype html> -<html lang="en" id="top"> - <head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="color-scheme" content="dark light"> - <link rel="icon" href="data:,"> - <title>{{TITLE}}</title> - <link href="https://arena.adast.dk/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" /> - <style>*{box-sizing:border-box;}body{font-family:sans-serif;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{overflow:auto;}table{text-align:left;width:100%;}</style> - </head> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="color-scheme" content="dark light"> + <link rel="icon" href="data:,"> + <title>{{TITLE}}</title> + <link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" /> + <link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" /> + <style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}blockquote{border-left:4px + solid;padding-left:5px;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;} + .posts,#menu{list-style:none;padding:0;}.posts li{margin-bottom:8px;}.posts li span{display:block;font-size:90%;}#menu li{display:inline-block;margin-right:8px;}.footnotes{font-size:90%;} + a:link{text-decoration:none;}a:visited{text-decoration:none;}a:hover{text-decoration:underline;}a:active{text-decoration:underline;}</style> +</head> - <nav> - <a href="#menu">Menu ↓</a> - </nav> +<nav id="top"> + <a href="/">Home</a><span> | </span><a href="#menu">Menu ↓</a> +</nav> - <main> +<main> @@ -1,14 +1,14 @@ -# arena: Quake-like multiplayer shooter +# Project Arena **arena** is a old-school arena shooter being made by me, [Adam Stück](https://adast.dk). -* [Gameplay clips](https://tv.adast.dk/c/arena/videos) +You can watch [gameplay clips](https://tv.adast.dk/c/arena/videos) on my PeerTube. + <!-- * [Follow my progress](https://trello.com/b/ycQyrouQ) --> -## Updates +## Updates 📢 -> 📢 **arena** is currently on hiatus. I am hoping to do a -> complete open-source rewrite using the [Godot game -> engine](https://godotengine.org).<br> -> ~ *2023-12-17* +**2023-12-17**<br> +**arena** is currently on hiatus. I am hoping to do a complete open-source +rewrite using the [Godot game engine](https://godotengine.org). |