diff --git a/repo2html b/repo2html
index 8a4b1f8..c0d63ca 100755
--- a/repo2html
+++ b/repo2html
@@ -20,6 +20,12 @@
# along with this program. If not, see .
# #
+path_out="$( pwd )"
+path="$( dirname "$0" )"
+cd "$path"
+
+export GIT_DIR="$path_out/.git"
+
cat <
@@ -40,7 +46,7 @@ while read hash commit ts id subject; do
echo "Found $commit: $subject" >&2
dateout="$( printf "%(%Y-%m-%d)T" "$ts" )"
- dategrp="${dateout%-*}"
+ dategroup="${dateout%-*}"
day="${dateout##*-}"
month="$( printf "%(%m)T" "$ts" )"
year="${dateout%%-*}"
@@ -52,28 +58,28 @@ while read hash commit ts id subject; do
pagefile="$year/$month/$id.html"
fmtsubject="$( ./msgfmt < <( echo "$subject"; echo ) )"
- [ "$lastdate" == "$dategrp" ] || {
- echo "$dategrp
"
+ [ "$lastdate" == "$dategroup" ] || {
+ echo "$dategroup
"
}
printf '' \
"$day" "$pagefile" "$fmtsubject"
- lastdate="$dategrp"
+ lastdate="$dategroup"
# create the containing directory (if it does not yet exist and then generate
# the commit page
mkdir -p "$( dirname "$pagefile" )" \
&& (
- printf "$( cat tpl/commit.html )" \
- "$fmtsubject" \
- "$fmtsubject" \
- "$ts" \
- "$( ./hash2html "$commit" )" \
- "$dategrp" \
- "$year" \
- "$hash"
- ) > "$pagefile"
+ # make the majority of the data available as environment variables (for
+ # convenience), lowercase so as not to be conflict with conventional
+ # environment variables
+ export hash commit id subject="$fmtsubject" timestamp="$ts"
+ export dategroup month day year
+
+ # invoke template
+ ./hash2html "$commit" | ./tpl/commit.sh
+ ) > "$path_out/$pagefile"
done < <(
git log --pretty='format:%H %h %at %f %s' && echo
)
diff --git a/rss b/rss
index 069a511..1efe00a 100755
--- a/rss
+++ b/rss
@@ -46,7 +46,7 @@ while read -r commit ts id subject; do
-
- $( printf "%s/%(%Y)T/%(%m)T/%s.html" "$url" "$ts" "$ts" "$id" )
+ $( printf "%s/%(%Y/%m)T/%s.html" "$url" "$ts" "$id" )
$( date --date="1970-01-01 $ts sec" +%Y-%m-%d )
diff --git a/tpl/commit.html b/tpl/commit.html
deleted file mode 100644
index 6c61a67..0000000
--- a/tpl/commit.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- %s
-
-
-
%s
- %(%Y-%m-%d)T
- %s
-
-
- (Return to index)
-
-
-
-
-
-
diff --git a/tpl/commit.sh b/tpl/commit.sh
new file mode 100755
index 0000000..1216f2f
--- /dev/null
+++ b/tpl/commit.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+cat <
+
+
+ $subject
+
+
+ $subject
+ $year-$month-$day
+
+
+ $( cat )
+
+
+
+ (Return to index)
+
+
+
+
+
+
+EOF