From 7c3e1cae316af08c926fe92c7a2fba23f46819dc Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Fri, 19 Oct 2012 20:09:31 -0400 Subject: [PATCH] msgfmt is now configurable The scripts that use it will still provide defaults for direct invocation --- git/commit2html | 5 ++++- processor | 5 ++++- repo2html | 8 ++++++-- rss | 5 ++++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/git/commit2html b/git/commit2html index 971d09c..69a64df 100755 --- a/git/commit2html +++ b/git/commit2html @@ -22,9 +22,12 @@ commit="${1?Missing commit}" +# provide default message formatter if necessary +msgfmt="${msgfmt:-./msgfmt}" + echo -n '

' git show --pretty=format:%b "$commit" \ - | ./msgfmt + | "$msgfmt" echo '

' diff --git a/processor b/processor index 7594b7c..80fd8ce 100755 --- a/processor +++ b/processor @@ -23,6 +23,9 @@ repotype="${1?Missing repository type}" path_out="${2?Missing output path}" +# provide default message formatter if necessary +msgfmt="${msgfmt:-./msgfmt}" + cat < @@ -66,7 +69,7 @@ while read hash commit ts id subject; do firstyear="$year" pagefile="$year/$month/$id.html" - fmtsubject="$( ./msgfmt < <( echo "$subject"; echo ) )" + fmtsubject="$( "$msgfmt" < <( echo "$subject"; echo ) )" [ "$prevdate" == "$dategroup" ] || { echo "

$dategroup

" diff --git a/repo2html b/repo2html index 17206f3..159bafb 100755 --- a/repo2html +++ b/repo2html @@ -47,12 +47,13 @@ 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: opt; do +while getopts t:d:c:l:f: opt; do case "$opt" in t) title="$OPTARG";; d) desc="$OPTARG";; c) copyright="$OPTARG";; l) license="$OPTARG";; + f) msgfmt="$OPTARG";; ?) exit 64;; esac done @@ -70,8 +71,11 @@ desc="${desc:-$( cwarn description )}" copyright="${copyright:-$( cwarn copyright 'Respective Authors' )}" license="${license:-$( cwarn license )}" +# provide default message formatter if necessary +msgfmt="${msgfmt:-./msgfmt}" + # make configuration available to all scripts -export title desc copyright license +export title desc copyright license msgfmt # pass commit list to the HTML and RSS processors "$repotype"/list | tee \ diff --git a/rss b/rss index 0caac1d..1ed7dae 100755 --- a/rss +++ b/rss @@ -24,6 +24,9 @@ repotype="${1?Missing repository type}" url="${2?Missing URL}" count=10 +# provide default message formatter if necessary +msgfmt="${msgfmt:-./msgfmt}" + # rss header cat < @@ -51,7 +54,7 @@ while read hash commit ts id subject; do # the title) cat < - <![CDATA[$( ./msgfmt -n < <( echo "$subject"; echo ) )]]> + <![CDATA[$( "$msgfmt" -n < <( echo "$subject"; echo ) )]]> $( printf "%s/%s/%s.html" \ "${url/%\/}" "$( ./tsdate "$ts" %Y/%m )" "$id"