summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-08-07 09:28:51 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-08-07 09:28:51 -0400
commitd8d6c0877391afc8d089632317399bbfdd409229 (patch)
tree6422a94a417bc23bf5331af2a63544a234ee8959
parent0084cc96cb575d268e80f5771e5c6179a089ea07 (diff)
Add "versions" to package count badge.
* guix-web (view-package): Pluralize "version" if needed and render next to package count.
-rwxr-xr-xguix-web10
1 files changed, 9 insertions, 1 deletions
diff --git a/guix-web b/guix-web
index 84c53e6..73c5641 100755
--- a/guix-web
+++ b/guix-web
@@ -206,6 +206,13 @@
(dd ,(render-package-license package))))
(let ((packages (find-packages-by-name name)))
+ (define (format-package-count)
+ (let ((count (length packages)))
+ (format #f "~d ~a"
+ count
+ (if (> count 1)
+ "versions"
+ "version"))))
`(html
(head
(title ,(string-append "GNU Guix - " name))
@@ -214,7 +221,8 @@
(body
(div (@ (class "container"))
(image (@ (src "/images/logo.png")))
- (h1 ,name (span (@ (class "badge")) ,(length packages)))
+ (h1 ,name (span (@ (class "badge"))
+ ,(format-package-count)))
(ul (@ (class "list-unstyled"))
,@(map (lambda (p)
`(li ,(describe-package p)))