#
# This is a quick script to produce an HTML page from sitecopy -ll mode.
# May be copied, redistributed, modified etc. under the terms
# of the GNU GPL, see the COPYING file for full details.
# Copyright (C) 1998-2002 Joe Orton
#
# To use it, run:
#
# sitecopy --flatlist sitename | gawk -f changes.awk > changes.html
#
# [mawk (v1.3.3) doesn't work: lacks strftime. Admittedly strftime
# is used only for the "generated by sitecopy" message
# at the end. Can replace with something like `date | getline now',
# which should work for gawk and mawk but not e.g. Solaris awk.
# It appears that there is no portable way of getting current time
# in awk. However, see below BUGS list.
#
# Of course, what we really want is when sitecopy was run,
# which needn't be the same as when this script is run.
#
#
# BUGS:
#
# - Doesn't make any provision for strange filenames (containing
# vertical bar (`|') or HTML-breaking things like `<', `&', `"'
# etc.).
#
# (Could be addressed by doing HTML-encoding of filenames from within
# sitecopy code, including encoding any `|' in filenames.)
#
# - Note that the timestamp in the output is when this awk script is
# run, not when `sitecopy --flatlist' was run. (This isn't a
# problem if you use the suggested pipe command, it's only relevant
# if you run this script on previously-generated flatlist files.)
#
# (Could be addressed by adding date information to
# `sitecopy --flatlist' output.)
#
BEGIN {
# The field separator is the vertical bar
FS = "|";
}
# This is called to print an item.
# hyperlink == 1 if the item should be hyperlinked,
# else 0.
function printitem( name ) {
printf( "
";
url = $3
}
/^siteend/ {
if( $2 == "unchanged" ) {
print "No changes have been recently made to the site.";
}
print "";
# Shameless plug. Remove it, go on, do it now.
# Just comment out the next four lines with #'s like these ones.
print "