aboutsummaryrefslogtreecommitdiff
path: root/phlogthis
diff options
context:
space:
mode:
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