Added cref tag support to msgfmt, permitting ref of previous commits
parent
a096f7ea19
commit
e7fadb3513
20
msgfmt
20
msgfmt
|
@ -42,7 +42,25 @@ done
|
||||||
|
|
||||||
|
|
||||||
# format the commit message, stopping at the diff (if any)
|
# 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;
|
| sed ':a;N;$!ba;
|
||||||
# handle <>-delimited links (strip delimiters)
|
# handle <>-delimited links (strip delimiters)
|
||||||
s#<\([fh]ttps\?://[^ ]\+\)>#\1#g;
|
s#<\([fh]ttps\?://[^ ]\+\)>#\1#g;
|
||||||
|
|
|
@ -76,7 +76,7 @@ license="${license:-$( cwarn license )}"
|
||||||
msgfmt="${msgfmt:-./msgfmt}"
|
msgfmt="${msgfmt:-./msgfmt}"
|
||||||
|
|
||||||
# make configuration available to all scripts
|
# 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
|
# pass commit list to the HTML and RSS processors
|
||||||
"$repotype"/list | tee \
|
"$repotype"/list | tee \
|
||||||
|
|
Loading…
Reference in New Issue