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}"
# provide default message formatter if necessary
msgfmt="${msgfmt:-./msgfmt}"
echo -n '<p>'
git show --pretty=format:%b "$commit" \
| ./msgfmt
| "$msgfmt"
echo '</p>'

View File

@ -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 <<EOH
<!DOCTYPE html>
<html>
@ -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 "<h3 id="$dategroup">$dategroup</h3>"

View File

@ -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 \

5
rss
View File

@ -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 <<EOH
<?xml version="1.0"?>
@ -51,7 +54,7 @@ while read hash commit ts id subject; do
# the title)
cat <<EOE
<item>
<title><![CDATA[$( ./msgfmt -n < <( echo "$subject"; echo ) )]]></title>
<title><![CDATA[$( "$msgfmt" -n < <( echo "$subject"; echo ) )]]></title>
<link>$(
printf "%s/%s/%s.html" \
"${url/%\/}" "$( ./tsdate "$ts" %Y/%m )" "$id"