From 35b57b07f63804ecf07b5c471a656a646b9d460a Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sat, 19 Aug 2023 19:29:04 +0200 Subject: New blog index; improved build script --- .gitignore | 1 - bottom.gmi | 7 -- build.sh | 81 ++++++++++++----------- src/blog/blog.md | 35 ---------- src/blog/feed.xml | 188 ------------------------------------------------------ 5 files changed, 44 insertions(+), 268 deletions(-) delete mode 100644 bottom.gmi delete mode 100644 src/blog/blog.md delete mode 100644 src/blog/feed.xml diff --git a/.gitignore b/.gitignore index f7a84cc..b338f99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ http -gemini HTML-TIPS diff --git a/bottom.gmi b/bottom.gmi deleted file mode 100644 index e171bf0..0000000 --- a/bottom.gmi +++ /dev/null @@ -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 index 8f3034a..e3b18bf 100755 --- 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 '$//' } -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 '

Blog

'; + echo ''; + echo 'RSS feed'; } >> "$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 "" >> $ff - echo "$t" >> $ff - echo "https://sebastiano.tronto.net/blog/$i" >> $ff - echo "$t" >> $ff - echo "$d" >> $ff - echo "" >> $ff - echo "" >> $ff + thisyear="$(echo "$d" | sed 's/-.*//')" + if [ "$thisyear" != "$lastyear" ]; then + echo "" >> "$bf" + lastyear=$thisyear fi + + { echo ""; + echo ""; } >> "$bf" + + { echo ""; + echo "$t"; + echo "https://sebastiano.tronto.net/blog/$i"; + echo "$t"; + echo "$d"; + echo ""; + echo ""; } >> $ff done - echo "" >> $ff - echo "" >> $ff - echo "" >> $ff + echo '

$thisyear

$d$t
' >> "$bf" + cat bottom.html >> "$bf" + + { echo ""; echo ""; echo ""; } >> "$ff" } -makeblog +makeblogindexandfeed recursivebuild src diff --git a/src/blog/blog.md b/src/blog/blog.md deleted file mode 100644 index 6c21cd5..0000000 --- a/src/blog/blog.md +++ /dev/null @@ -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 deleted file mode 100644 index 9c39603..0000000 --- a/src/blog/feed.xml +++ /dev/null @@ -1,188 +0,0 @@ - - - - -Sebastiano Tronto's blog -https://sebastiano.tronto.net/blog - -Thoughts about software, computers and whatever I feel like sharing - - - -My minimalistic RSS feed setup -https://sebastiano.tronto.net/blog/2023-07-11-feed -My minimalistic RSS feed setup -2023-07-11 - - - -UNIX text filters, part 0 of 3: regular expressions -https://sebastiano.tronto.net/blog/2023-06-16-regex -UNIX text filters, part 0 of 3: regular expressions -2023-06-16 - - - -I had to debug C code on a smartphone -https://sebastiano.tronto.net/blog/2023-05-05-debug-smartphone -I had to debug C code on a smartphone -2023-05-05 - - - -The big rewrite -https://sebastiano.tronto.net/blog/2023-04-10-the-big-rewrite -The big rewrite -2023-04-10 - - - -The man page reading club: dc(1) -https://sebastiano.tronto.net/blog/2023-03-30-dc -The man page reading club: dc(1) -2023-03-30 - - - -Resizing my website's pictures with ImageMagick and find(1) -https://sebastiano.tronto.net/blog/2023-03-06-resize-pictures -Resizing my website's pictures with ImageMagick and find(1) -2023-03-06 - - - -Job control: one shell is all you need -https://sebastiano.tronto.net/blog/2023-02-25-job-control -Job control: one shell is all you need -2023-02-25 - - - -The year of the Windows desktop -https://sebastiano.tronto.net/blog/2023-01-28-windows-desktop -The year of the Windows desktop -2023-01-28 - - - -Aaron Swartz -https://sebastiano.tronto.net/blog/2023-01-11-aaron-swartz -Aaron Swartz -2023-01-11 - - - -Getting my blog ready for 2023 -https://sebastiano.tronto.net/blog/2022-12-30-blog-ready -Getting my blog ready for 2023 -2022-12-30 - - - -The man page reading club: ed(1) -https://sebastiano.tronto.net/blog/2022-12-24-ed -The man page reading club: ed(1) -2022-12-24 - - - -Self-hosted git pages with stagit (featuring ed, the standard editor) -https://sebastiano.tronto.net/blog/2022-11-23-git-host -Self-hosted git pages with stagit (featuring ed, the standard editor) -2022-11-23 - - - -Keeping my email sorted (the hard way) -https://sebastiano.tronto.net/blog/2022-10-19-email-setup -Keeping my email sorted (the hard way) -2022-10-19 - - - -The man page reading club: tetris(6) -https://sebastiano.tronto.net/blog/2022-10-01-tetris -The man page reading club: tetris(6) -2022-10-01 - - - -The man page reading club: sh(1) - part 2: commands and builtins -https://sebastiano.tronto.net/blog/2022-09-20-sh-2 -The man page reading club: sh(1) - part 2: commands and builtins -2022-09-20 - - - -The man page reading club: sh(1) - part 1: shell grammar -https://sebastiano.tronto.net/blog/2022-09-13-sh-1 -The man page reading club: sh(1) - part 1: shell grammar -2022-09-13 - - - -Long live netbooks! -https://sebastiano.tronto.net/blog/2022-09-10-netbooks -Long live netbooks! -2022-09-10 - - - -Pipe man into col -b to get rid of \^H -https://sebastiano.tronto.net/blog/2022-09-05-man-col -Pipe man into col -b to get rid of \^H -2022-09-05 - - - -How I update my website -https://sebastiano.tronto.net/blog/2022-08-14-website -How I update my website -2022-08-14 - - - -The man page reading club: shutdown(8) -https://sebastiano.tronto.net/blog/2022-07-07-shutdown -The man page reading club: shutdown(8) -2022-07-07 - - - -The UNIX shell as an IDE: look stuff up with sed -https://sebastiano.tronto.net/blog/2022-06-12-shell-ide-sed -The UNIX shell as an IDE: look stuff up with sed -2022-06-12 - - - -The man page reading club: more(1) -https://sebastiano.tronto.net/blog/2022-06-08-more -The man page reading club: more(1) -2022-06-08 - - - -The gemini protocol -https://sebastiano.tronto.net/blog/2022-06-04-gemini -The gemini protocol -2022-06-04 - - - -The man page reading club: man(1) -https://sebastiano.tronto.net/blog/2022-05-29-man -The man page reading club: man(1) -2022-05-29 - - - -Blogs -https://sebastiano.tronto.net/blog/2022-05-21-blogs -Blogs -2022-05-21 - - - - - -- cgit v1.3