Mike Gerwitz

Free Software Hacker+Activist

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mtg@gnu.org>2019-01-16 23:59:26 -0500
committerMike Gerwitz <mtg@gnu.org>2019-01-17 01:29:46 -0500
commit6d9defe292e3ade1be7fb87f576659e3cc10cc8e (patch)
treed91b68ddd90cf951a0066fbb3ff7b5d5f4f0c72f
parentf38aada7818e8c95e3ff0fcf7af812d96572ce0a (diff)
downloadthoughts-6d9defe292e3ade1be7fb87f576659e3cc10cc8e.tar.gz
thoughts-6d9defe292e3ade1be7fb87f576659e3cc10cc8e.tar.bz2
thoughts-6d9defe292e3ade1be7fb87f576659e3cc10cc8e.zip
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.
-rwxr-xr-xsrc/post2html14
-rw-r--r--style.css5
2 files changed, 17 insertions, 2 deletions
diff --git a/src/post2html b/src/post2html
index 1785541..803fef7 100755
--- a/src/post2html
+++ b/src/post2html
@@ -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"
}
diff --git a/style.css b/style.css
index 3b146e7..2bf5c59 100644
--- a/style.css
+++ b/style.css
@@ -92,6 +92,11 @@ a:visited { color: #6666cc; }
text-decoration: none;
}
+a.muted {
+ color: inherit;
+ text-decoration: none;
+}
+
a.box {
display: block;