Title, description, copyright and license are now configurable
Warnings will be output to stderr if any are not provided.master
parent
dd6c1679e5
commit
5cb939fe0a
|
@ -27,10 +27,11 @@ cat <<EOH
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Mike Gerwitz's Thoughts and Ramblings</title>
|
<title>$title</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Mike Gerwitz's Thoughts and Ramblings</h1>
|
<h1>$title</h1>
|
||||||
|
<h2>$desc</h2>
|
||||||
EOH
|
EOH
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ while read hash commit ts id subject; do
|
||||||
fmtsubject="$( ./msgfmt < <( echo "$subject"; echo ) )"
|
fmtsubject="$( ./msgfmt < <( echo "$subject"; echo ) )"
|
||||||
|
|
||||||
[ "$prevdate" == "$dategroup" ] || {
|
[ "$prevdate" == "$dategroup" ] || {
|
||||||
echo "<h2 id="$dategroup">$dategroup</h2>"
|
echo "<h3 id="$dategroup">$dategroup</h3>"
|
||||||
}
|
}
|
||||||
|
|
||||||
printf '<ul><li>(%02d) <a href="%s">%s</a></li></ul>' \
|
printf '<ul><li>(%02d) <a href="%s">%s</a></li></ul>' \
|
||||||
|
@ -91,7 +92,7 @@ fi
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
<hr />
|
<hr />
|
||||||
<footer>
|
<footer>
|
||||||
<div>Copyright © $yearrange Mike Gerwitz</div>
|
<div>Copyright © $yearrange $copyright</div>
|
||||||
<div>Last Updated: $( printf "%(%F %H:%M:%S)T" "$lastts" )</div>
|
<div>Last Updated: $( printf "%(%F %H:%M:%S)T" "$lastts" )</div>
|
||||||
<div>$lasthash</div>
|
<div>$lasthash</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
33
repo2html
33
repo2html
|
@ -32,9 +32,42 @@ else
|
||||||
exit 128
|
exit 128
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# store our cwd and enter our own (to make invoking relative scripts easier)
|
||||||
path_out="$( pwd )"
|
path_out="$( pwd )"
|
||||||
path="$( dirname "$0" )"
|
path="$( dirname "$0" )"
|
||||||
cd "$path"
|
cd "$path"
|
||||||
|
|
||||||
|
# provides configuration warning and outputs a default
|
||||||
|
cwarn()
|
||||||
|
{
|
||||||
|
echo "Warning: no $1 provided; defaulting to: ${2:-(empty)}" >&2
|
||||||
|
echo "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
# configuration (note that this setup in conjunction with the below defaults
|
||||||
|
# imply that they can be passed in as environment variables as an alternative to
|
||||||
|
# options)
|
||||||
|
while getopts t:d:c:l: opt; do
|
||||||
|
case "$opt" in
|
||||||
|
t) title="$OPTARG";;
|
||||||
|
d) desc="$OPTARG";;
|
||||||
|
c) copyright="$OPTARG";;
|
||||||
|
l) license="$OPTARG";;
|
||||||
|
?) exit 64;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# default title to repository name (as taken from the directory)
|
||||||
|
title="${title:-$( cwarn title $( basename "$path_out" ) )}"
|
||||||
|
desc="${desc:-$( cwarn description )}"
|
||||||
|
|
||||||
|
# default to a restrictive copyright (unfortunately, that's the best we can do,
|
||||||
|
# since copyright is restrictive by default)
|
||||||
|
copyright="${copyright:-$( cwarn copyright 'Respective Authors' )}"
|
||||||
|
license="${license:-$( cwarn license )}"
|
||||||
|
|
||||||
|
# make configuration available to all scripts
|
||||||
|
export title desc copyright license
|
||||||
|
|
||||||
# pass commit list to the processor
|
# pass commit list to the processor
|
||||||
"$repotype"/list | ./processor "$repotype" "$path_out"
|
"$repotype"/list | ./processor "$repotype" "$path_out"
|
||||||
|
|
|
@ -19,9 +19,8 @@ cat <<EOF
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<footer>
|
<footer>
|
||||||
Copyright © $year Mike Gerwitz.
|
Copyright © $year $copyright.
|
||||||
Verbatim redistribution of this document in its entirety is permitted so
|
$license
|
||||||
long as this copyright notice is preserved.
|
|
||||||
|
|
||||||
<div>$hash</div>
|
<div>$hash</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
Loading…
Reference in New Issue