From 1181d999a9acb8a82845dc397d84fc7f944c5ab2 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 21 Sep 2019 12:41:39 +0100 Subject: Serve the README.html file on the site --- guix-data-service/config.scm.in | 7 +++++++ guix-data-service/web/controller.scm | 3 +++ guix-data-service/web/view/html.scm | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/guix-data-service/config.scm.in b/guix-data-service/config.scm.in index 20323c6..ab34254 100644 --- a/guix-data-service/config.scm.in +++ b/guix-data-service/config.scm.in @@ -30,6 +30,13 @@ (if (file-exists? install-dir) install-dir dev-dir))) + (doc-dir . ,(let ((install-dir + "@prefix@/share/doc/guix-data-service") + (dev-dir + (getcwd))) + (if (file-exists? install-dir) + install-dir + dev-dir))) (host . "localhost") (port . 8765) diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm index 423f4c0..55a136e 100644 --- a/guix-data-service/web/controller.scm +++ b/guix-data-service/web/controller.scm @@ -720,6 +720,9 @@ #t) 200 500)))) + (('GET "README") + (render-html + #:sxml (readme))) (_ (with-postgresql-connection "web" diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm index 622c692..d0b480b 100644 --- a/guix-data-service/web/view/html.scm +++ b/guix-data-service/web/view/html.scm @@ -23,12 +23,14 @@ #:use-module (guix-data-service web util) #:use-module (ice-9 vlist) #:use-module (ice-9 match) + #:use-module (ice-9 textual-ports) #:use-module (srfi srfi-1) #:use-module (srfi srfi-19) #:use-module (texinfo) #:use-module (texinfo html) #:use-module (json) #:export (index + readme general-not-found unknown-revision view-statistics @@ -221,6 +223,25 @@ '()))) '()))))) +(define (readme) + (layout + #:body + `(,(header) + (div + (@ (class "container")) + (div + (@ (class "row")) + (div + (@ (class "col-sm-12")) + (h1 "The README document"))) + (div + (@ (class "row")) + (div + (@ (class "col-sm-12")) + (raw ,(call-with-input-file + (string-append (%config 'doc-dir) "/README.html") + get-string-all)))))))) + (define (index git-repositories-and-revisions) (layout #:body -- cgit v1.2.3