Handle the README.html file being missing
This commit is contained in:
parent
970bcb31cf
commit
b96bc58422
2 changed files with 14 additions and 7 deletions
|
|
@ -20,6 +20,7 @@
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (ice-9 vlist)
|
#:use-module (ice-9 vlist)
|
||||||
#:use-module (ice-9 pretty-print)
|
#:use-module (ice-9 pretty-print)
|
||||||
|
#:use-module (ice-9 textual-ports)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-11)
|
#:use-module (srfi srfi-11)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
|
|
@ -30,6 +31,7 @@
|
||||||
#:use-module (texinfo plain-text)
|
#:use-module (texinfo plain-text)
|
||||||
#:use-module (squee)
|
#:use-module (squee)
|
||||||
#:use-module (json)
|
#:use-module (json)
|
||||||
|
#:use-module (guix-data-service config)
|
||||||
#:use-module (guix-data-service comparison)
|
#:use-module (guix-data-service comparison)
|
||||||
#:use-module (guix-data-service database)
|
#:use-module (guix-data-service database)
|
||||||
#:use-module (guix-data-service model git-branch)
|
#:use-module (guix-data-service model git-branch)
|
||||||
|
|
@ -721,8 +723,16 @@
|
||||||
200
|
200
|
||||||
500))))
|
500))))
|
||||||
(('GET "README")
|
(('GET "README")
|
||||||
|
(let ((filename (string-append (%config 'doc-dir) "/README.html")))
|
||||||
|
(if (file-exists? filename)
|
||||||
(render-html
|
(render-html
|
||||||
#:sxml (readme)))
|
#:sxml (readme (call-with-input-file filename
|
||||||
|
get-string-all)))
|
||||||
|
(render-html
|
||||||
|
#:sxml (general-not-found
|
||||||
|
"README not found"
|
||||||
|
"The README.html file does not exist")
|
||||||
|
#:code 404))))
|
||||||
(_
|
(_
|
||||||
(with-postgresql-connection
|
(with-postgresql-connection
|
||||||
"web"
|
"web"
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@
|
||||||
#:use-module (guix-data-service web util)
|
#:use-module (guix-data-service web util)
|
||||||
#:use-module (ice-9 vlist)
|
#:use-module (ice-9 vlist)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (ice-9 textual-ports)
|
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-19)
|
#:use-module (srfi srfi-19)
|
||||||
#:use-module (texinfo)
|
#:use-module (texinfo)
|
||||||
|
|
@ -223,7 +222,7 @@
|
||||||
'())))
|
'())))
|
||||||
'())))))
|
'())))))
|
||||||
|
|
||||||
(define (readme)
|
(define (readme contents)
|
||||||
(layout
|
(layout
|
||||||
#:body
|
#:body
|
||||||
`(,(header)
|
`(,(header)
|
||||||
|
|
@ -238,9 +237,7 @@
|
||||||
(@ (class "row"))
|
(@ (class "row"))
|
||||||
(div
|
(div
|
||||||
(@ (class "col-sm-12"))
|
(@ (class "col-sm-12"))
|
||||||
(raw ,(call-with-input-file
|
(raw ,contents)))))))
|
||||||
(string-append (%config 'doc-dir) "/README.html")
|
|
||||||
get-string-all))))))))
|
|
||||||
|
|
||||||
(define (index git-repositories-and-revisions)
|
(define (index git-repositories-and-revisions)
|
||||||
(layout
|
(layout
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue