123456789101112131415161718192021222324252627282930 |
- (library (templates debug)
- (export debug-table-template)
- (import
- (except (rnrs base) let-values error)
- (only (guile)
- lambda* λ
- ;; input output
- with-output-to-string
- display
- write)
- ;; standard web library
- (web request)
- (web response)
- (web uri)))
- (define debug-table-template
- (λ (request body)
- `((h1 "hello world!")
- (table
- (tr (th "header") (th "value"))
- ;; splice in all request headers
- ,@(map (lambda (pair)
- `(tr (td (tt ,(with-output-to-string
- (lambda () (display (car pair))))))
- (td (tt ,(with-output-to-string
- (lambda ()
- (write (cdr pair))))))))
- (request-headers request))))))
|