diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-09-28 20:01:54 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-09-28 20:01:54 +0200 |
commit | 04e14174274d70fb69ed9bb1717ee80cf7f8ad65 (patch) | |
tree | 008a971d2a06c40e5c41decde20ec90a5e4a25f6 /phlogthis | |
parent | 3ee2fd5b7645a559c3257f52949286265d299358 (diff) | |
download | scripts-04e14174274d70fb69ed9bb1717ee80cf7f8ad65.tar.gz scripts-04e14174274d70fb69ed9bb1717ee80cf7f8ad65.tar.bz2 scripts-04e14174274d70fb69ed9bb1717ee80cf7f8ad65.zip |
update
Diffstat (limited to 'phlogthis')
-rwxr-xr-x | phlogthis | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -4,6 +4,7 @@ # requires the text formating utility 'par' root=$HOME/src/gopher/phlog +remoteroot=/srv/gopher/phlog mkdir -p $HOME/.tmp pushd "$(pwd)" @@ -11,13 +12,16 @@ cd $HOME/.tmp || exit editfile="phlogtmp.txt" articledate="$(date -R)" filedate="$(date +%Y-%m-%d-%H-%I)" +article="/tmp/gophermap.tmp" read -r -p "Enter title: " title filetitle=$(echo $title | sed 's/ /-/g' | sed 's/[^A-Za-z0-9._-]//g') -article=$filedate-$filetitle.txt +dirname="$filedate-$filetitle" + +mkdir $root/$dirname +#ssh spike mkdir $remoteroot/$dirname -dest="$root/$article" micro +4:1 "$editfile" @@ -25,9 +29,10 @@ micro +4:1 "$editfile" # non-empty line doesn't contain spaces cat "$editfile" | par -jw67 > $article -header="title:$title\ndate:$articledate\n$(printf '%*s' 66 | tr ' ' '-')\n\n" +header="$title\n$articledate\n+$(printf '%*s' 65 | tr ' ' '-')+\n\n" sed -i "1s/^/$header/" $article +dest="$root/$dirname/gophermap" mv "$article" "$dest" rm $editfile echo "Article saved as $dest" @@ -43,9 +48,11 @@ 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 +dirs=($(ls -dr */)) +for dir in "${dirs[@]}"; do + dt=$(echo $dir| cut -c 1-10) + tt="$(head -n 1 $dir/gophermap)" + echo -e "1$dt $tt\t/phlog/$dir\tspike.nagatha.fr\t70" >> gophermap done popd |