Back to slide
Keyboard shortcut: 'u'  Slide 11 : 26
Program 1

(load (string-append laml-dir "laml.scm"))

(lib-load "html4.0-loose/basis.scm")
(lib-load "html4.0-loose/surface.scm")
(lib-load "html4.0-loose/convenience.scm")

(lib-load "file-read.scm")

(define (html-write html-string)
  (write-text-file
    html-string
    (string-append 
      (startup-directory) (source-filename-without-extension) "." "html")
  )
)

(define row list)

(define (html-page ttl . body-forms)
  (html 
    (title ttl)
    (apply body
      (cons
        (h1 ttl)
        body-forms))))

; Assume at least one row
(define (table-by-rows border . rows)
 (let ((first-row (car rows))
       (other-rows (cdr rows)))
  (html4:table 
    (string-append 
     (table-row first-row #t)
     (apply string-append
         (map (lambda (row) (table-row row #f)) other-rows)))
    'border border)))

(define (table-row lst header?)
 (html4:tr
   (apply string-append
      (map (lambda (cell)
              ((if header? html4:th html4:td) (as-string cell)))
           lst))))