Link to source code of post
Rather than displaying the hash separately, this just makes the date a link to the source code. Until I display a modification date, this will also make it easy to see the history of the file.master
parent
f38aada781
commit
6d9defe292
|
@ -29,6 +29,8 @@
|
|||
# the date, and we want to do all HTML processing now.
|
||||
##
|
||||
|
||||
declare -r srcref=/projects/thoughts/tree
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Pandoc output format and extensions.
|
||||
|
@ -59,6 +61,7 @@ pexts()
|
|||
hgroup-wrap()
|
||||
{
|
||||
local -r date=${1?Missing date}
|
||||
local -r file=${2?Missing file}
|
||||
|
||||
# Abort if this is not a date prefix
|
||||
[[ $date =~ [0-9]{4}-[0-9]{2}-[0-9]{2} ]] || {
|
||||
|
@ -66,9 +69,16 @@ hgroup-wrap()
|
|||
return
|
||||
}
|
||||
|
||||
local -r repo_href="$srcref/$file"
|
||||
|
||||
local anchor
|
||||
printf -vanchor '<a class="muted" href="%s">%s</a>' \
|
||||
"$repo_href" \
|
||||
"$date"
|
||||
|
||||
sed '/^<h1/{
|
||||
i<hgroup>
|
||||
a<h2 class="date">'"$date"'</h2></hgroup>
|
||||
a<h2 class="date">'"$anchor"'</h2></hgroup>
|
||||
}'
|
||||
}
|
||||
|
||||
|
@ -89,7 +99,7 @@ main()
|
|||
-A src/footer.tpl.htm \
|
||||
< "$file" \
|
||||
| src/h12title @__PAGE_TITLE__@ \
|
||||
| hgroup-wrap "$date"
|
||||
| hgroup-wrap "$date" "$file"
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue