small Makefile fixes
[~bandali/bndl.org] / bandali / utils.scm
1 ;;; Copyright © 2019 Amin Bandali <bandali@gnu.org>
2 ;;;
3 ;;; This program is free software; you can redistribute it and/or
4 ;;; modify it under the terms of the GNU General Public License as
5 ;;; published by the Free Software Foundation; either version 3 of the
6 ;;; License, or (at your option) any later version.
7 ;;;
8 ;;; This program is distributed in the hope that it will be useful,
9 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ;;; General Public License for more details.
12 ;;;
13 ;;; You should have received a copy of the GNU General Public License
14 ;;; along with this program. If not, see
15 ;;; <http://www.gnu.org/licenses/>.
16
17 (define-module (bandali utils)
18 #:export (aa
19 stylesheet
20 intersperse))
21
22 (define* (aa content #:optional (uri content) . title)
23 `(a (@ (href ,uri) (title ,(apply string-append title))) ,content))
24
25 (define (stylesheet name)
26 `(link (@ (rel "stylesheet")
27 (href ,(string-append "/" name ".css")))))
28
29 (define (intersperse lst delim)
30 "Return the elements of LST delimited by DELIM, such that the
31 resulting list is of an odd length and every second element is DELIM."
32 (if (<= (length lst) 1)
33 lst
34 (cons* (car lst)
35 delim
36 (intersperse (cdr lst) delim))))