From 6a609ceb565c81fbfd3d13ed48ada00eef25298d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 20 May 2019 18:10:53 +0200 Subject: Add git version to HTML info footer. --- module/output/html.scm | 15 +++++++++++++-- 1 file 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) -- cgit v1.2.3