#!/bin/bash
# /usr/local/bin/recently_updated
# https://crystalfaeries/posix/bin/recently_updated
# celeste:crystalfaery RECENTLY_UPDATED 2017-06-14 23:49:04+00:00
# recently_updated generates a webpage indexing by date (inverse order)
# the webpages in the blog generated by chronicle (ignores rest of website)
# this is primarily invoked during the run of /usr/local/bin/blog,
# so that upon each regeneration of the blog we update the date index page.
# because chonicle fully regenerates all webpages for any update,
# we have to use the dates of the source files which chronicle works from.
cd -P /home/crystalfaeries.net/src/ || exit 1
echo -e "<html><head><title>Recently Updated</title></head><body bgcolor="#000000" text="#FFFFFF" vlink="#FFFFFF" alink="#333333" link="#CCCCCC"><a href="/fae/"><h1 align="center">Recently Updated</h1></a>" \
> /home/crystalfaeries.net/recently_updated.html # Title and Header
echo -e "<a href="/recently_linked.html"><img src="/clipart/clock.png" alt="[clock]" align="right" width="219" height="219"></a>" \
>> /home/crystalfaeries.net/recently_updated.html # Title and Header
echo -e "<p>#\tDate______\tTime___________\tTimezone\tURL_relative_to_https://crystalfaeries.net/<br>" \
>> /home/crystalfaeries.net/recently_updated.html # Column Headings
let i=0
for f in $(ls -t *.txt)
do
g="$(echo "${f}" | sed 's/\.txt$//;s/+/_/g;s/-/_/g;s/\./_/g;s/$/.html/;s/^/\/fae\//')"
let i+=1
echo -e "<a href="$g"\t>$i\t$(stat --format %y $f)\t$g</a><br>" \
>> /home/crystalfaeries.net/recently_updated.html
done
echo -e "</p>" >> /home/crystalfaeries.net/recently_updated.html
cat /home/crystalfaeries.net/README.html >> /home/crystalfaeries.net/recently_updated.html
syntax highlighted by Code2HTML, v. 0.9.1