diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2018-10-24 17:11:06 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2018-10-24 17:11:06 +0200 |
commit | cadca16bf478383ff4681ffbefe379fcbf1328fc (patch) | |
tree | 62dafd04473247bd5d8a0117dd41a135a92505c1 /display.scm | |
parent | Made parse.scm into a module. (diff) | |
download | lyslib-master.tar.gz lyslib-master.tar.xz |
Diffstat (limited to 'display.scm')
-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)))))) |