commit 35b57b07f63804ecf07b5c471a656a646b9d460a
parent 3a2940a9648a4a6e3b47b5a55643f357fc7e6790
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Sat, 19 Aug 2023 19:29:04 +0200
New blog index; improved build script
Diffstat:
5 files changed, 44 insertions(+), 268 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,3 +1,2 @@
http
-gemini
HTML-TIPS
diff --git a/bottom.gmi b/bottom.gmi
@@ -1,7 +0,0 @@
----
-=> mailto:sebastiano@tronto.net Email me at sebastiano@tronto.net
-=> / Home
-=> /blog Blog
-=> /speedcubing Cubing
-=> https://sebastiano.tronto.net website
-=> https://git.tronto.net webgit
diff --git a/build.sh b/build.sh
@@ -1,14 +1,14 @@
#!/bin/sh
recursivebuild() {
- local destdir=$(echo $1 | sed 's|^src|http|')
+ local destdir=$(echo "$1" | sed 's|^src|http|')
mkdir -p "$destdir"
- for file in $(ls $1); do
- if [ -d "$1/$file" ]; then
- mkdir -p "$destdir/$file"
- recursivebuild "$1/$file"
+ for file in "$1"/*; do
+ if [ -d "$file" ]; then
+ mkdir -p "$destdir/$(basename "$file")"
+ recursivebuild "$file"
else
- copyfile "$1/$file" "$destdir"
+ copyfile "$file" "$destdir"
fi
done
}
@@ -20,63 +20,70 @@ copyfile() {
extension=$(echo "$file" | sed 's/.*\.//')
case "$extension" in
md)
- t="$(markdowntitle $file)"
+ t="$(markdowntitle "$file")"
sed "s/TITLE/$t/" < top.html > "$ind"
lowdown "$file" >> "$ind"
cat bottom.html >> "$ind"
;;
html)
- t="$(htmltitle $file)"
+ t="$(htmltitle "$file")"
cat top.html "$file" bottom.html | sed "s/TITLE/$t/" > "$ind"
;;
*)
- cp "$file" "$dest/$(basename $file)"
+ cp "$file" "$dest/$(basename "$file")"
esac
}
markdowntitle() {
- grep '^# ' $1 | head -n 1 | sed 's/^# //'
+ grep '^# ' "$1" | head -n 1 | sed 's/^# //'
}
htmltitle() {
grep '<!--TITLE: ' "$1" | sed 's/^<!--TITLE: //' | sed 's/-->$//'
}
-makeblog() {
- bf=src/blog/blog.md
- ff=src/blog/feed.xml
+makeblogindexandfeed() {
+ mkdir -p http/blog
+ bf=http/blog/index.html
+ ff=http/blog/feed.xml
- printf "# Blog\n\n[RSS Feed](feed.xml)\n\n" > $bf
- cp feed-top.xml $ff
+ sed "s/TITLE/Blog/" < top.html > "$bf"
+ { echo '<h1 id="blog">Blog</h1>';
+ echo '<table id="blog">';
+ echo '<a href="feed.xml">RSS feed</a>'; } >> "$bf"
- for i in $(ls src/blog | sort -r); do
- if [ -d src/blog/$i ]; then
- f="src/blog/$i/*.md"
- d=$(echo $i | grep -oE '^[0-9]{4}-[0-9]{2}-[0-9]{2}')
- t=$(head -n 1 $f | sed 's/# //')
+ cp feed-top.xml "$ff"
- thisyear=$(echo $d | sed 's/-.*//')
- if [ "$thisyear" != "$lastyear" ]; then
- printf "\n## $thisyear\n\n" >> $bf
- lastyear=$thisyear
- fi
+ for i in $(ls src/blog | sort -r); do
+ [ -d "src/blog/$i" ] || continue
- echo "* $d [$t]($i)" >> $bf
+ f="src/blog/$i/*.md"
+ d="$(echo "$i" | grep -oE '^[0-9]{4}-[0-9]{2}-[0-9]{2}')"
+ t="$(head -n 1 $f | sed 's/# //')"
- echo "<item>" >> $ff
- echo "<title>$t</title>" >> $ff
- echo "<link>https://sebastiano.tronto.net/blog/$i</link>" >> $ff
- echo "<description>$t</description>" >> $ff
- echo "<pubDate>$d</pubDate>" >> $ff
- echo "</item>" >> $ff
- echo "" >> $ff
+ thisyear="$(echo "$d" | sed 's/-.*//')"
+ if [ "$thisyear" != "$lastyear" ]; then
+ echo "<tr><td><h2>$thisyear</h2></td></tr>" >> "$bf"
+ lastyear=$thisyear
fi
+
+ { echo "<tr><td>$d</td>";
+ echo "<td><a href=\"$i\">$t</a></td></tr>"; } >> "$bf"
+
+ { echo "<item>";
+ echo "<title>$t</title>";
+ echo "<link>https://sebastiano.tronto.net/blog/$i</link>";
+ echo "<description>$t</description>";
+ echo "<pubDate>$d</pubDate>";
+ echo "</item>";
+ echo ""; } >> $ff
done
- echo "" >> $ff
- echo "</channel>" >> $ff
- echo "</rss>" >> $ff
+ echo '</table>' >> "$bf"
+ cat bottom.html >> "$bf"
+
+ { echo ""; echo "</channel>"; echo "</rss>"; } >> "$ff"
}
-makeblog
+makeblogindexandfeed
recursivebuild src
diff --git a/src/blog/blog.md b/src/blog/blog.md
@@ -1,35 +0,0 @@
-# Blog
-
-[RSS Feed](feed.xml)
-
-
-## 2023
-
-* 2023-07-11 [My minimalistic RSS feed setup](2023-07-11-feed)
-* 2023-06-16 [UNIX text filters, part 0 of 3: regular expressions](2023-06-16-regex)
-* 2023-05-05 [I had to debug C code on a smartphone](2023-05-05-debug-smartphone)
-* 2023-04-10 [The big rewrite](2023-04-10-the-big-rewrite)
-* 2023-03-30 [The man page reading club: dc(1)](2023-03-30-dc)
-* 2023-03-06 [Resizing my website's pictures with ImageMagick and find(1)](2023-03-06-resize-pictures)
-* 2023-02-25 [Job control: one shell is all you need](2023-02-25-job-control)
-* 2023-01-28 [The year of the Windows desktop](2023-01-28-windows-desktop)
-* 2023-01-11 [Aaron Swartz](2023-01-11-aaron-swartz)
-
-## 2022
-
-* 2022-12-30 [Getting my blog ready for 2023](2022-12-30-blog-ready)
-* 2022-12-24 [The man page reading club: ed(1)](2022-12-24-ed)
-* 2022-11-23 [Self-hosted git pages with stagit (featuring ed, the standard editor)](2022-11-23-git-host)
-* 2022-10-19 [Keeping my email sorted (the hard way)](2022-10-19-email-setup)
-* 2022-10-01 [The man page reading club: tetris(6)](2022-10-01-tetris)
-* 2022-09-20 [The man page reading club: sh(1) - part 2: commands and builtins](2022-09-20-sh-2)
-* 2022-09-13 [The man page reading club: sh(1) - part 1: shell grammar](2022-09-13-sh-1)
-* 2022-09-10 [Long live netbooks!](2022-09-10-netbooks)
-* 2022-09-05 [Pipe man into col -b to get rid of \^H](2022-09-05-man-col)
-* 2022-08-14 [How I update my website](2022-08-14-website)
-* 2022-07-07 [The man page reading club: shutdown(8)](2022-07-07-shutdown)
-* 2022-06-12 [The UNIX shell as an IDE: look stuff up with sed](2022-06-12-shell-ide-sed)
-* 2022-06-08 [The man page reading club: more(1)](2022-06-08-more)
-* 2022-06-04 [The gemini protocol](2022-06-04-gemini)
-* 2022-05-29 [The man page reading club: man(1)](2022-05-29-man)
-* 2022-05-21 [Blogs](2022-05-21-blogs)
diff --git a/src/blog/feed.xml b/src/blog/feed.xml
@@ -1,188 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<rss version="2.0">
-
-<channel>
-<title>Sebastiano Tronto's blog</title>
-<link>https://sebastiano.tronto.net/blog</link>
-<description>
-Thoughts about software, computers and whatever I feel like sharing
-</description>
-
-<item>
-<title>My minimalistic RSS feed setup</title>
-<link>https://sebastiano.tronto.net/blog/2023-07-11-feed</link>
-<description>My minimalistic RSS feed setup</description>
-<pubDate>2023-07-11</pubDate>
-</item>
-
-<item>
-<title>UNIX text filters, part 0 of 3: regular expressions</title>
-<link>https://sebastiano.tronto.net/blog/2023-06-16-regex</link>
-<description>UNIX text filters, part 0 of 3: regular expressions</description>
-<pubDate>2023-06-16</pubDate>
-</item>
-
-<item>
-<title>I had to debug C code on a smartphone</title>
-<link>https://sebastiano.tronto.net/blog/2023-05-05-debug-smartphone</link>
-<description>I had to debug C code on a smartphone</description>
-<pubDate>2023-05-05</pubDate>
-</item>
-
-<item>
-<title>The big rewrite</title>
-<link>https://sebastiano.tronto.net/blog/2023-04-10-the-big-rewrite</link>
-<description>The big rewrite</description>
-<pubDate>2023-04-10</pubDate>
-</item>
-
-<item>
-<title>The man page reading club: dc(1)</title>
-<link>https://sebastiano.tronto.net/blog/2023-03-30-dc</link>
-<description>The man page reading club: dc(1)</description>
-<pubDate>2023-03-30</pubDate>
-</item>
-
-<item>
-<title>Resizing my website's pictures with ImageMagick and find(1)</title>
-<link>https://sebastiano.tronto.net/blog/2023-03-06-resize-pictures</link>
-<description>Resizing my website's pictures with ImageMagick and find(1)</description>
-<pubDate>2023-03-06</pubDate>
-</item>
-
-<item>
-<title>Job control: one shell is all you need</title>
-<link>https://sebastiano.tronto.net/blog/2023-02-25-job-control</link>
-<description>Job control: one shell is all you need</description>
-<pubDate>2023-02-25</pubDate>
-</item>
-
-<item>
-<title>The year of the Windows desktop</title>
-<link>https://sebastiano.tronto.net/blog/2023-01-28-windows-desktop</link>
-<description>The year of the Windows desktop</description>
-<pubDate>2023-01-28</pubDate>
-</item>
-
-<item>
-<title>Aaron Swartz</title>
-<link>https://sebastiano.tronto.net/blog/2023-01-11-aaron-swartz</link>
-<description>Aaron Swartz</description>
-<pubDate>2023-01-11</pubDate>
-</item>
-
-<item>
-<title>Getting my blog ready for 2023</title>
-<link>https://sebastiano.tronto.net/blog/2022-12-30-blog-ready</link>
-<description>Getting my blog ready for 2023</description>
-<pubDate>2022-12-30</pubDate>
-</item>
-
-<item>
-<title>The man page reading club: ed(1)</title>
-<link>https://sebastiano.tronto.net/blog/2022-12-24-ed</link>
-<description>The man page reading club: ed(1)</description>
-<pubDate>2022-12-24</pubDate>
-</item>
-
-<item>
-<title>Self-hosted git pages with stagit (featuring ed, the standard editor)</title>
-<link>https://sebastiano.tronto.net/blog/2022-11-23-git-host</link>
-<description>Self-hosted git pages with stagit (featuring ed, the standard editor)</description>
-<pubDate>2022-11-23</pubDate>
-</item>
-
-<item>
-<title>Keeping my email sorted (the hard way)</title>
-<link>https://sebastiano.tronto.net/blog/2022-10-19-email-setup</link>
-<description>Keeping my email sorted (the hard way)</description>
-<pubDate>2022-10-19</pubDate>
-</item>
-
-<item>
-<title>The man page reading club: tetris(6)</title>
-<link>https://sebastiano.tronto.net/blog/2022-10-01-tetris</link>
-<description>The man page reading club: tetris(6)</description>
-<pubDate>2022-10-01</pubDate>
-</item>
-
-<item>
-<title>The man page reading club: sh(1) - part 2: commands and builtins</title>
-<link>https://sebastiano.tronto.net/blog/2022-09-20-sh-2</link>
-<description>The man page reading club: sh(1) - part 2: commands and builtins</description>
-<pubDate>2022-09-20</pubDate>
-</item>
-
-<item>
-<title>The man page reading club: sh(1) - part 1: shell grammar</title>
-<link>https://sebastiano.tronto.net/blog/2022-09-13-sh-1</link>
-<description>The man page reading club: sh(1) - part 1: shell grammar</description>
-<pubDate>2022-09-13</pubDate>
-</item>
-
-<item>
-<title>Long live netbooks!</title>
-<link>https://sebastiano.tronto.net/blog/2022-09-10-netbooks</link>
-<description>Long live netbooks!</description>
-<pubDate>2022-09-10</pubDate>
-</item>
-
-<item>
-<title>Pipe man into col -b to get rid of \^H</title>
-<link>https://sebastiano.tronto.net/blog/2022-09-05-man-col</link>
-<description>Pipe man into col -b to get rid of \^H</description>
-<pubDate>2022-09-05</pubDate>
-</item>
-
-<item>
-<title>How I update my website</title>
-<link>https://sebastiano.tronto.net/blog/2022-08-14-website</link>
-<description>How I update my website</description>
-<pubDate>2022-08-14</pubDate>
-</item>
-
-<item>
-<title>The man page reading club: shutdown(8)</title>
-<link>https://sebastiano.tronto.net/blog/2022-07-07-shutdown</link>
-<description>The man page reading club: shutdown(8)</description>
-<pubDate>2022-07-07</pubDate>
-</item>
-
-<item>
-<title>The UNIX shell as an IDE: look stuff up with sed</title>
-<link>https://sebastiano.tronto.net/blog/2022-06-12-shell-ide-sed</link>
-<description>The UNIX shell as an IDE: look stuff up with sed</description>
-<pubDate>2022-06-12</pubDate>
-</item>
-
-<item>
-<title>The man page reading club: more(1)</title>
-<link>https://sebastiano.tronto.net/blog/2022-06-08-more</link>
-<description>The man page reading club: more(1)</description>
-<pubDate>2022-06-08</pubDate>
-</item>
-
-<item>
-<title>The gemini protocol</title>
-<link>https://sebastiano.tronto.net/blog/2022-06-04-gemini</link>
-<description>The gemini protocol</description>
-<pubDate>2022-06-04</pubDate>
-</item>
-
-<item>
-<title>The man page reading club: man(1)</title>
-<link>https://sebastiano.tronto.net/blog/2022-05-29-man</link>
-<description>The man page reading club: man(1)</description>
-<pubDate>2022-05-29</pubDate>
-</item>
-
-<item>
-<title>Blogs</title>
-<link>https://sebastiano.tronto.net/blog/2022-05-21-blogs</link>
-<description>Blogs</description>
-<pubDate>2022-05-21</pubDate>
-</item>
-
-
-</channel>
-</rss>