aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-05-20 18:10:53 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2019-05-20 18:21:11 +0200
commit6a609ceb565c81fbfd3d13ed48ada00eef25298d (patch)
treeec507e633c2b386ffaecc2d7bd4b39cc23b75a2a
parentAdd basic server. (diff)
downloadcalp-6a609ceb565c81fbfd3d13ed48ada00eef25298d.tar.gz
calp-6a609ceb565c81fbfd3d13ed48ada00eef25298d.tar.xz
Add git version to HTML info footer.
-rw-r--r--module/output/html.scm15
1 files changed, 13 insertions, 2 deletions
diff --git a/module/output/html.scm b/module/output/html.scm
index bfc392b7..e19c2995 100644
--- a/module/output/html.scm
+++ b/module/output/html.scm
@@ -173,6 +173,7 @@
(cdr p)))
param)) ,d)))
+
;; 0 indexed, starting at monday.
(define (week-day date)
(modulo (1- (date-week-day date)) 7))
@@ -211,6 +212,12 @@
(cons `(tr ,@w)
(recur rest)))))))))
+(define *repo-url* "https://git.hornquist.se")
+
+(define (get-git-version)
+ (read ((@ (ice-9 popen) open-input-pipe)
+ "git rev-parse HEAD")))
+
(define-public (html-generate calendars events start end)
(define evs (get-groups-between (group-stream events)
start end))
@@ -246,8 +253,12 @@
(div (@ (class "days"))
,@(stream->list (stream-map lay-out-day evs))))
(footer (span "Page generated " ,(date->string (current-date)))
- (span (a (@ (href "https://git.hornquist.se/calparse"))
- "Source Code"))))
+ (span (a (@ (href ,*repo-url* "/calparse"))
+ "Source Code"))
+ ,(let* ((hash (get-git-version))
+ (url (format #f "~a/calparse/commit/?id=~a"
+ *repo-url* hash)))
+ `(span "Version " (a (@ (href ,url)) ,hash)))))
(aside (@ (class "sideinfo"))
(div (@ (class "about"))
(div ,(cal-table (start-of-month start)