summaryrefslogtreecommitdiff
path: root/display.scm
blob: 6a2faded598abd9ca16b9acabc9cd2e8eb4758a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/guile \
-e main -s
!#

(add-to-load-path (dirname (current-filename)))
(add-to-load-path (string-append (getenv "HOME")
                                 "/lib/guile"))


(use-modules (parse)
             (sxml simple))

(define (build-table csv)
  `(table (@ (border 1))
          (tr (th "Title") (th "Author"))
          ,@(map (lambda (i)
                   `(tr (td ,(csv-ref csv 'title i))
                        (td ,(csv-ref csv 'author_details i))))
               (iota (csv-length csv)))) )

(define (main args)
  (let ((csv (load-csv* "boklista.csv")))
    (sxml->xml
     `(html (head (title "Boklista"))
            (body
             ,(build-table csv))))))