1
0
Fork 0

msgfmt is now configurable

The scripts that use it will still provide defaults for direct invocation
master
Mike Gerwitz 2012-10-19 20:09:31 -04:00
parent 1cb7c53b6e
commit 7c3e1cae31
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
4 changed files with 18 additions and 5 deletions

View File

@ -22,9 +22,12 @@
commit="${1?Missing commit}" commit="${1?Missing commit}"
# provide default message formatter if necessary
msgfmt="${msgfmt:-./msgfmt}"
echo -n '<p>' echo -n '<p>'
git show --pretty=format:%b "$commit" \ git show --pretty=format:%b "$commit" \
| ./msgfmt | "$msgfmt"
echo '</p>' echo '</p>'

View File

@ -23,6 +23,9 @@
repotype="${1?Missing repository type}" repotype="${1?Missing repository type}"
path_out="${2?Missing output path}" path_out="${2?Missing output path}"
# provide default message formatter if necessary
msgfmt="${msgfmt:-./msgfmt}"
cat <<EOH cat <<EOH
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@ -66,7 +69,7 @@ while read hash commit ts id subject; do
firstyear="$year" firstyear="$year"
pagefile="$year/$month/$id.html" pagefile="$year/$month/$id.html"
fmtsubject="$( ./msgfmt < <( echo "$subject"; echo ) )" fmtsubject="$( "$msgfmt" < <( echo "$subject"; echo ) )"
[ "$prevdate" == "$dategroup" ] || { [ "$prevdate" == "$dategroup" ] || {
echo "<h3 id="$dategroup">$dategroup</h3>" echo "<h3 id="$dategroup">$dategroup</h3>"

View File

@ -47,12 +47,13 @@ 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: opt; do while getopts t:d:c:l:f: opt; do
case "$opt" in case "$opt" in
t) title="$OPTARG";; t) title="$OPTARG";;
d) desc="$OPTARG";; d) desc="$OPTARG";;
c) copyright="$OPTARG";; c) copyright="$OPTARG";;
l) license="$OPTARG";; l) license="$OPTARG";;
f) msgfmt="$OPTARG";;
?) exit 64;; ?) exit 64;;
esac esac
done done
@ -70,8 +71,11 @@ desc="${desc:-$( cwarn description )}"
copyright="${copyright:-$( cwarn copyright 'Respective Authors' )}" copyright="${copyright:-$( cwarn copyright 'Respective Authors' )}"
license="${license:-$( cwarn license )}" license="${license:-$( cwarn license )}"
# provide default message formatter if necessary
msgfmt="${msgfmt:-./msgfmt}"
# make configuration available to all scripts # 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 # pass commit list to the HTML and RSS processors
"$repotype"/list | tee \ "$repotype"/list | tee \

5
rss
View File

@ -24,6 +24,9 @@ repotype="${1?Missing repository type}"
url="${2?Missing URL}" url="${2?Missing URL}"
count=10 count=10
# provide default message formatter if necessary
msgfmt="${msgfmt:-./msgfmt}"
# rss header # rss header
cat <<EOH cat <<EOH
<?xml version="1.0"?> <?xml version="1.0"?>
@ -51,7 +54,7 @@ while read hash commit ts id subject; do
# the title) # the title)
cat <<EOE cat <<EOE
<item> <item>
<title><![CDATA[$( ./msgfmt -n < <( echo "$subject"; echo ) )]]></title> <title><![CDATA[$( "$msgfmt" -n < <( echo "$subject"; echo ) )]]></title>
<link>$( <link>$(
printf "%s/%s/%s.html" \ printf "%s/%s/%s.html" \
"${url/%\/}" "$( ./tsdate "$ts" %Y/%m )" "$id" "${url/%\/}" "$( ./tsdate "$ts" %Y/%m )" "$id"