1
0
Fork 0

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.
master
Mike Gerwitz 2013-05-17 23:10:56 -04:00
parent dc99621cc1
commit 397d8837a9
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
3 changed files with 8 additions and 3 deletions

View File

@ -26,6 +26,10 @@ path_out="${2?Missing output path}"
# provide default message formatter if necessary # provide default message formatter if necessary
msgfmt="${msgfmt:-./msgfmt}" 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 # output XHTML5 header
cat <<EOH cat <<EOH
@ -94,7 +98,7 @@ while read hash commit ts id subject; do
export path_root='../../' export path_root='../../'
# invoke template # invoke template
"$repotype"/commit2html "$commit" | ./tpl/commit.sh "$repotype"/commit2html "$commit" | "$path_tpl/commit"
) > "$path_out/$pagefile" \ ) > "$path_out/$pagefile" \
&& ./hashcache "$hash" "$pagefile" && ./hashcache "$hash" "$pagefile"
done done

View File

@ -67,7 +67,7 @@ cwarn()
# configuration (note that this setup in conjunction with the below defaults # 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 # imply that they can be passed in as environment variables as an alternative to
# options) # 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 case "$opt" in
t) title="$OPTARG";; t) title="$OPTARG";;
d) desc="$OPTARG";; d) desc="$OPTARG";;
@ -75,6 +75,7 @@ while getopts t:d:c:l:f:R: opt; do
l) license="$OPTARG";; l) license="$OPTARG";;
f) msgfmt="$OPTARG";; f) msgfmt="$OPTARG";;
R) rss_count="$OPTARG";; R) rss_count="$OPTARG";;
T) path_tpl="$OPTARG";;
?) exit 64;; ?) exit 64;;
esac esac
done done
@ -96,7 +97,7 @@ license="${license:-$( cwarn license )}"
msgfmt="${msgfmt:-./msgfmt}" msgfmt="${msgfmt:-./msgfmt}"
# make configuration available to all scripts # 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 # 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) # we offer a flag that opts out of reprocessing previously processed commits)