Commit Diff


commit - f43c847e4845c73e3f0de92b9f67df1fbc0ba62b
commit + 469be48e163a66d38ef3e063007b3ca90d552606
blob - 84b9254d21efe35042ae3ece52cf5f43129162a7
blob + feb031a358a861abdd888ae5b25bd3c1417004b8
--- GotMArc.pm
+++ GotMArc.pm
@@ -68,11 +68,14 @@ sub readall {
 	<$fh>;
 }
 
-my $small_logo = readall "templates/logo-small.html";
-my $hdr = readall "templates/head.html";
-my $foot = readall "templates/foot.html";
-my $idxhdr = readall "templates/index-header.html";
+my $templates = $ENV{TMPLDIR};
+die 'undefined $TMPLDIR' unless defined $templates;
 
+my $small_logo = readall "$templates/logo-small.html";
+my $hdr = readall "$templates/head.html";
+my $foot = readall "$templates/foot.html";
+my $idxhdr = readall "$templates/index-header.html";
+
 sub initpage {
 	my ($fh, $title) = @_;
 	say $fh $hdr =~ s/TITLE/$title/r;
blob - e298f9b824c965127978cb7b05c0152bdd9d1ecc
blob + 90adab2a1714da3460e0d3092ed3e9bd54471225
--- gotmarc
+++ gotmarc
@@ -6,23 +6,27 @@
 
 progname="$(basename "$0")"
 usage() {
-	echo "usage: $progname [-c cachedir] [-j n] [-m maildir] [-o outdir]">&2
+	u="usage: $progname [-c cachedir] [-j n]"
+	u="$u [-m maildir] [-o outdir] [-t tmpldir]"
+	echo "$u">&2
 	exit 1
 }
 
 libexec=.
 mblaze=.mblaze
+tmpldir=templates/
 
 cachedir=$HOME/.cache/gotmarc
 mdir=$HOME/Mail/gotmarc
 outdir=/var/www/gotmarc
 
-while getopts c:j:m:o: flag; do
+while getopts c:j:m:o:t: flag; do
 	case $flag in
 	c) cachedir="$OPTARG" ;;
 	j) MAKE_JOBS="$OPTARG" ;;
 	m) mdir="$OPTARG" ;;
 	o) outdir="$OPTARG" ;;
+	t) tmpldir="$OPTARG" ;;
 	?) usage ;;
 	esac
 done
@@ -34,6 +38,7 @@ export MBLAZE="$mblaze"
 export MBLAZE_PAGER=cat
 export MDIR="$mdir"
 export OUTDIR="${outdir:-/var/www/gotmarc}"
+export TMPLDIR="$tmpldir"
 
 # make sure the directories are there
 set -e
blob - 02bba65eefe801e0c6134d883df25157a103a436
blob + cff6fe0167118e0c7d107285b0fa797efc285ad9
--- gotmarc.1
+++ gotmarc.1
@@ -13,6 +13,7 @@
 .Op Fl j Ar n
 .Op Fl m Ar maildir
 .Op Fl o Ar outdir
+.Op Fl t Ar tmpldir
 .Sh DESCRIPTION
 .Nm
 generates a static web archive from a maildir incrementally.
@@ -39,9 +40,27 @@ Defaults to
 The destination directory where the HTML files will be written to, it's
 .Pa /var/www/gotmarc
 by default.
+.It Fl t Ar tmpldir
+Path to a directory containing the template files.
+.Pa /etc/gotmarc
+by default.
 .El
 .Sh FILES
-.Bl -tag -compact -width ~/.cache/gotmarc
+.Bl -tag -width Ds
+.It Pa /etc/gotmarc/foot.html
+Template with the trailing part of the page.
+.It Pa /etc/gotmarc/head.html
+Template with the first part of the page.
+.Dv TITLE
+is substituted with the title.
+.It Pa /etc/gotmarc/index-header.html
+Template with the title for index pages.
+.Dv PAGE
+is replaced with the page number and
+.Dv SUBTITLE
+with the date range.
+.It Pa /etc/gotmarc/logo-small.html
+Small version of the logo, included in the thread header.
 .It Pa /var/www/gotmarc
 Default output directory.
 .It Pa ~/.cache/gotmarc