From 397d8837a91e99a355b8b049c8d75c8afbfbec71 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Fri, 17 May 2013 23:10:56 -0400 Subject: [PATCH] Added configurable template path via path_tpl env var (-T option to repo2html) The .sh extension was removed from the commit filename to recognize the fact that configurable templates may be any type of executable. --- processor | 6 +++++- repo2html | 5 +++-- tpl/{commit.sh => commit} | 0 3 files changed, 8 insertions(+), 3 deletions(-) rename tpl/{commit.sh => commit} (100%) diff --git a/processor b/processor index 74bba7f..2f1b6b7 100755 --- a/processor +++ b/processor @@ -26,6 +26,10 @@ path_out="${2?Missing output path}" # provide default message formatter if necessary msgfmt="${msgfmt:-./msgfmt}" +# default template path (the former is exported so that templates themselves may +# make use of default templates) +export path_default_tpl=./tpl +path_tpl="${path_tpl:-$path_default_tpl}" # output XHTML5 header cat < "$path_out/$pagefile" \ && ./hashcache "$hash" "$pagefile" done diff --git a/repo2html b/repo2html index 16ec4f3..2c79d87 100755 --- a/repo2html +++ b/repo2html @@ -67,7 +67,7 @@ cwarn() # 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:f:R: opt; do +while getopts t:d:c:l:f:R:T: opt; do case "$opt" in t) title="$OPTARG";; d) desc="$OPTARG";; @@ -75,6 +75,7 @@ while getopts t:d:c:l:f:R: opt; do l) license="$OPTARG";; f) msgfmt="$OPTARG";; R) rss_count="$OPTARG";; + T) path_tpl="$OPTARG";; ?) exit 64;; esac done @@ -96,7 +97,7 @@ license="${license:-$( cwarn license )}" msgfmt="${msgfmt:-./msgfmt}" # make configuration available to all scripts -export title desc copyright license msgfmt url_root +export title desc copyright license msgfmt url_root path_tpl # clear the cachefile (TODO: we could maintain cache files from previous runs if # we offer a flag that opts out of reprocessing previously processed commits) diff --git a/tpl/commit.sh b/tpl/commit similarity index 100% rename from tpl/commit.sh rename to tpl/commit