diff options
-rwxr-xr-x | display.scm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/display.scm b/display.scm new file mode 100755 index 0000000..6a2fade --- /dev/null +++ b/display.scm @@ -0,0 +1,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)))))) |