Store and display the location of packages

Store the location a package can be found at, and display this on the package
page.

If available, link off to the git repository containing the package.
This commit is contained in:
Christopher Baines 2019-05-13 21:02:53 +01:00
parent 9aaab6b751
commit 7341d17254
15 changed files with 217 additions and 28 deletions

View file

@ -302,7 +302,7 @@
(define (view-revision-package-and-version revision-commit-hash name version
package-metadata
derivations)
derivations git-repositories)
(layout
#:extra-headers
'((cache-control . ((max-age . 60))))
@ -327,7 +327,7 @@
(div
(@ (class "col-sm-12"))
,(match package-metadata
(((synopsis description home-page))
(((synopsis description home-page file line column-number))
`(dl
(@ (class "dl-horizontal"))
(dt "Synopsis")
@ -335,8 +335,27 @@
(dt "Description")
(dd ,(stexi->shtml (texi-fragment->stexi description)))
(dt "Home page")
(dd (a (@ (href ,home-page))
,home-page)))))))
(dd (a (@ (href ,home-page)) ,home-page))
,@(if (and file (not (string-null? file))
(not (null? git-repositories)))
`((dt "Location")
(dd ,@(map
(match-lambda
((id label url cgit-url-base)
(if
(and cgit-url-base
(not (string-null? cgit-url-base)))
`(a (@ (href
,(string-append
cgit-url-base "tree/"
file "?id=" revision-commit-hash
"#n" line)))
,file
" (line: " ,line
", column: " ,column-number ")")
'())))
git-repositories)))
'()))))))
(div
(@ (class "row"))
(div