[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/10: website: utils: 'paginate' correctly handles the case with zero i
From: |
Ludovic Courtès |
Subject: |
05/10: website: utils: 'paginate' correctly handles the case with zero items. |
Date: |
Sat, 29 Jul 2017 12:33:18 -0400 (EDT) |
civodul pushed a commit to branch wip-website-update
in repository guix-artwork.
commit 097215e6ddbef3c559baba6692b2439980aed815
Author: Ludovic Courtès <address@hidden>
Date: Sat Jul 29 17:27:21 2017 +0200
website: utils: 'paginate' correctly handles the case with zero items.
* website/apps/base/utils.scm (paginate): Handle case when GROUPED-DATA
is empty.
---
website/apps/base/utils.scm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/website/apps/base/utils.scm b/website/apps/base/utils.scm
index 39e4e82..e081652 100644
--- a/website/apps/base/utils.scm
+++ b/website/apps/base/utils.scm
@@ -27,6 +27,7 @@
#:use-module (apps base types)
#:use-module (haunt page)
#:use-module (ice-9 i18n)
+ #:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:export (gnu-url
guix-git-tree-url
@@ -175,7 +176,11 @@
(let* ((page-number (cons "page-number" 1))
(path (path-join base-path "index.html"))
(items
- (cons "items" (first grouped-data)))
+ (match grouped-data
+ (()
+ (cons "items" '()))
+ ((head _ ...)
+ (cons "items" head))))
(new-context
(append context
(list items page-number total-pages))))
- branch wip-website-update created (now cf672e3), Ludovic Courtès, 2017/07/29
- 05/10: website: utils: 'paginate' correctly handles the case with zero items.,
Ludovic Courtès <=
- 03/10: website: posts: Add missing tags and harmonize., Ludovic Courtès, 2017/07/29
- 02/10: website: packages: Ignore third-party packages., Ludovic Courtès, 2017/07/29
- 04/10: website: Rename 'guix.scm' to 'build.scm'., Ludovic Courtès, 2017/07/29
- 09/10: website: packages: Fix typo., Ludovic Courtès, 2017/07/29
- 10/10: website: packages: Implement patch links., Ludovic Courtès, 2017/07/29
- 07/10: website: packages: Interpret synopsis/description Texinfo., Ludovic Courtès, 2017/07/29
- 08/10: website: packages: Add the commit in package source URLs., Ludovic Courtès, 2017/07/29
- 06/10: website: packages: Implement grouping by letter., Ludovic Courtès, 2017/07/29