diff --git a/msgfmt b/msgfmt index 9937e01..9f1c07a 100755 --- a/msgfmt +++ b/msgfmt @@ -42,7 +42,25 @@ done # format the commit message, stopping at the diff (if any) -awk '/^diff --git/ { exit } { print }' \ +awk -vurl_root="$url_root" ' + # replace commit refs with generated URL (allows linking to prior commits + # without hard-coding the configurable links that could change or be + # relative to where the content is hosted); this will then be processed as a + # normal URL by the remainder of the script + match($0, /\[cref:(.*?)\]/, g) { + # retrieve the URL from the hashcache and perform the line replacement + # (which will be reflected once we print the line) + c = "./hashcache " g[1] + c | getline result + gsub(/\[cref:.*?\]/, url_root result) + } + + # stop printing at diff + /^diff --git/ { exit } + + # otherwise, print everything + { print } + ' \ | sed ':a;N;$!ba; # handle <>-delimited links (strip delimiters) s#<\([fh]ttps\?://[^ ]\+\)>#\1#g; diff --git a/repo2html b/repo2html index 7d64bc4..a70989d 100755 --- a/repo2html +++ b/repo2html @@ -76,7 +76,7 @@ license="${license:-$( cwarn license )}" msgfmt="${msgfmt:-./msgfmt}" # make configuration available to all scripts -export title desc copyright license msgfmt +export title desc copyright license msgfmt url_root # pass commit list to the HTML and RSS processors "$repotype"/list | tee \