summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2018-10-24 17:11:06 +0200
committerHugo Hörnquist <hugo@hornquist.se>2018-10-24 17:11:06 +0200
commitcadca16bf478383ff4681ffbefe379fcbf1328fc (patch)
tree62dafd04473247bd5d8a0117dd41a135a92505c1
parentMade parse.scm into a module. (diff)
downloadlyslib-master.tar.gz
lyslib-master.tar.xz
Add display code for generating HTML table.HEADmaster
-rwxr-xr-xdisplay.scm26
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))))))