summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfr33domlover <fr33domlover@riseup.net>2019-07-06 01:29:56 +0300
committerfr33domlover <fr33domlover@riseup.net>2019-07-06 01:29:56 +0300
commit93f2dec9f32a4999d2865491fccaafa52c166b12 (patch)
treea66ec0a6ab98a4a24ccefd3e307352f59d063379
parent2803822e29dbfd43871f86fa3dd1993a78b43e4d (diff)
Specify date and commit ID in spec titles
-rwxr-xr-xbuild.sh26
-rw-r--r--html/template.html16
2 files changed, 41 insertions, 1 deletions
diff --git a/build.sh b/build.sh
index 2bf5a40..728ab57 100755
--- a/build.sh
+++ b/build.sh
@@ -2,19 +2,45 @@
inputs="forgefed forgefed-vocabulary"
+git_branch=`git rev-parse --abbrev-ref HEAD`
+
+git_commit_id=`git rev-parse HEAD`
+
+git_commit_id_short=`git rev-parse --short HEAD`
+
+now=`date --utc +%Y-%m-%d`
+
+dirty () {
+ git diff-index --quiet HEAD --
+}
+
render () {
dir="$1"
file="$2"
+
if [ "$3" == "true" ]; then
toc="--table-of-contents"
else
toc=""
fi
+
+ dirty
+ if [ $? -eq 0 ]; then
+ gitdirty=""
+ else
+ gitdirty="--variable gitdirty"
+ fi
+
pandoc $dir/$file.md \
--from markdown \
--to html \
--template html/template.html \
$toc \
+ $gitdirty \
+ --variable "gitbranch:$git_branch" \
+ --variable "gitcommitid:$git_commit_id" \
+ --variable "gitcommitidshort:$git_commit_id_short" \
+ --variable "date:$now" \
--number-sections \
--output html/$file.html
}
diff --git a/html/template.html b/html/template.html
index 80b6990..7e27bc1 100644
--- a/html/template.html
+++ b/html/template.html
@@ -24,13 +24,27 @@
</nav>
</header>
<main class="main">
- <h1 class="main-title">$title$</h1>
+ $if(toc)$
+ <h1 class="main-title">
+ $title$ - draft - $date$ $gitbranch$
+ <a href="https://notabug.org/peers/forgefed/commit/$gitcommitid$">
+ $gitcommitidshort$
+ </a>
+ $if(gitdirty)$
+ [dirty]
+ $endif$
+ </h1>
+ $else$
+ <h1 class="main-title">$title$</h1>
+ $endif$
+
$if(toc)$
<nav class="toc">
<header class="toc-title">Table of Contents</header>
$toc$
</nav>
$endif$
+
$body$
</main>
<footer class="footer">