Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike@mikegerwitz.com>2013-06-06 14:23:58 -0400
committerMike Gerwitz <mike@mikegerwitz.com>2013-06-06 14:24:01 -0400
commit0e0414027abbfa20a8b74fbdb0a24a020a6a66fd (patch)
tree95a0acf5fc164a350ae377aa17a0119d5745ab48
parente7f9e58b631e3681d1009e1f4f1b497e1782ddb2 (diff)
downloadrepo2html-0e0414027abbfa20a8b74fbdb0a24a020a6a66fd.tar.gz
repo2html-0e0414027abbfa20a8b74fbdb0a24a020a6a66fd.tar.bz2
repo2html-0e0414027abbfa20a8b74fbdb0a24a020a6a66fd.zip
-E option now represents html url extension
This is useful for URL rewriting. The -E option was previously used to denote an empty -e and can still be done with `-e ''`. To use a URL rewriting scheme that removes the extension, use -E ''. To support this change properly, and to support users who may not want to use `.' as their extension prefix, it is no longer automatically added. (This breaks backwards compatibility, but -E was pushed publically so recently that this change is likely to affect anyone but, well, me.)
-rwxr-xr-xprocessor11
-rwxr-xr-xrepo2html9
2 files changed, 11 insertions, 9 deletions
diff --git a/processor b/processor
index 3c29c70..39c6b44 100755
--- a/processor
+++ b/processor
@@ -34,13 +34,12 @@ outfgen()
{
ts="${1?Missing timestamp}"
id="${2?Missing commit id}"
- ext="${3:+.$3}"
dateout="$( ./tsdate "$ts" %Y-%m-%d )"
month="$( ./tsdate "$ts" %m )"
year="${dateout%%-*}"
- echo "$year/$month/$id$ext"
+ echo "$year/$month/$id"
}
@@ -82,7 +81,9 @@ do-index()
lastyear="${lastyear:-$year}"
firstyear="$year"
- pagefile="$( outfgen "$ts" "$id" "$html_ext" )"
+ pagefile_base="$( outfgen "$ts" "$id" )"
+ pagefile_url="$pagefile_base$html_url_ext"
+ pagefile="$pagefile_base$html_ext"
fmtsubject="$( "$msgfmt" -P < <( echo "$subject"; echo ) )"
[ "$prevdate" == "$dategroup" ] || {
@@ -90,7 +91,7 @@ do-index()
$headout "$dategroup"
}
- $lineout "$day" "$pagefile" "$fmtsubject"
+ $lineout "$day" "$pagefile_url" "$fmtsubject"
prevdate="$dategroup"
@@ -107,7 +108,7 @@ do-index()
# invoke template
"$repotype"/commit2html "$commit" | apply-template commit
) > "$path_out/$pagefile" \
- && ./hashcache "$hash" "$pagefile" "$subject"
+ && ./hashcache "$hash" "$pagefile_url" "$subject"
done
$footout
diff --git a/repo2html b/repo2html
index 48bc272..48ab1ef 100755
--- a/repo2html
+++ b/repo2html
@@ -89,14 +89,15 @@ cfgpath="$path_tpl/.config"
}
# some initial defaults
-html_ext="${html_ext:-.html}"
+export html_ext="${html_ext-.html}"
+export html_link_ext="${html_link_ext-.html}"
do_raw=
raw_tpl=
# 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:e:l:f:i:o:u:C:ER:T:U: opt; do
+while getopts t:d:c:e:l:f:i:o:u:C:E:R:T:U: opt; do
case "$opt" in
t) title="$OPTARG";;
d) desc="$OPTARG";;
@@ -119,7 +120,7 @@ while getopts t:d:c:e:l:f:i:o:u:C:ER:T:U: opt; do
u) repo_url="$OPTARG";;
U) repo_commit_url="$OPTARG";;
C) html_external_css="$OPTARG";;
- E) html_ext=;;
+ E) html_link_ext="$OPTARG";;
R) rss_count="$OPTARG";;
T) ;; #already handled
?) exit 64;;
@@ -147,7 +148,7 @@ msgfmt="${msgfmt:-$default}"
# make configuration available to all scripts
export title desc copyright license msgfmt url_root path_tpl path \
html_external_css html_footer html_index_footer html_commit_footer \
- html_ext html_pre_index html_body_class html_tsep repo_url repo_commit_url
+ html_pre_index html_body_class html_tsep repo_url repo_commit_url
# if raw processing was requested, then we are done; pass the torch
test $do_raw && {