aboutsummaryrefslogtreecommitdiff
path: root/phlogthis
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-09-26 09:21:44 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-09-26 09:21:44 +0200
commit1eb8c4e7d504b37cd93708074430441beb60852f (patch)
tree453ac64438feffd90252df55975c6af10368b54d /phlogthis
parentefb7f14986de782f5bb6d6391589e1bfeaf9f46c (diff)
downloadscripts-1eb8c4e7d504b37cd93708074430441beb60852f.tar.gz
scripts-1eb8c4e7d504b37cd93708074430441beb60852f.tar.bz2
scripts-1eb8c4e7d504b37cd93708074430441beb60852f.zip
update
Diffstat (limited to 'phlogthis')
-rwxr-xr-xphlogthis13
1 files changed, 6 insertions, 7 deletions
diff --git a/phlogthis b/phlogthis
index 08410e1..4dc7fd0 100755
--- a/phlogthis
+++ b/phlogthis
@@ -1,8 +1,7 @@
#!/bin/bash
# create phlog entry, rebuild gophermap
-# requires par for text formatting
-
+# requires the text formating utility 'par'
root=$HOME/src/gopher/phlog
@@ -22,17 +21,18 @@ dest="$root/$article"
micro +4:1 "$editfile"
-# article
-cat "$editfile" | par -jw67 >> "$article"
+# Justify article. This may fail if a
+# non-empty line doesn't contain spaces
+cat "$editfile" | par -jw67 > $article
-header="title:$title\ndate:$articledate\n\n"
+header="title:$title\ndate:$articledate\n$(printf '%*s' 66 | tr ' ' '-')\n\n"
sed -i "1s/^/$header/" $article
mv "$article" "$dest"
rm $editfile
echo "Article saved as $dest"
-# create gophermap
+# build gophermap
cd $root
@@ -43,7 +43,6 @@ echo "" >> gophermap
echo "0[Rss feed] /phlog/rss.xml spike.nagatha.fr 70" >> gophermap
echo "" >> gophermap
-
files=($(ls -1r *.txt))
for file in "${files[@]}"; do
echo -e "0$(head -n 1 $file | sed s/title://g)\t/phlog/$file\tspike.nagatha.fr\t70" >> gophermap