templatize uses (web uri)
* tekuti/template.scm (templatize): Use define* and keyword args instead of taking a "request" object. Use (web uri) for URI work.
This commit is contained in:
parent
820b449cbc
commit
0d4fc4e501
1 changed files with 9 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
;; Tekuti
|
;; Tekuti
|
||||||
;; Copyright (C) 2008 Andy Wingo <wingo at pobox dot com>
|
;; Copyright (C) 2008, 2010 Andy Wingo <wingo at pobox dot com>
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or
|
;; This program is free software; you can redistribute it and/or
|
||||||
;; modify it under the terms of the GNU General Public License as
|
;; modify it under the terms of the GNU General Public License as
|
||||||
|
@ -25,13 +25,16 @@
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(define-module (tekuti template)
|
(define-module (tekuti template)
|
||||||
#:use-module (tekuti request)
|
#:use-module (web uri)
|
||||||
#:use-module (tekuti config)
|
#:use-module (tekuti config)
|
||||||
#:export (templatize))
|
#:export (templatize))
|
||||||
|
|
||||||
(define (templatize request)
|
(define* (templatize #:key
|
||||||
|
(title *title*)
|
||||||
|
(body '((p "(missing content?)"))))
|
||||||
(define (href . args)
|
(define (href . args)
|
||||||
`(href ,(apply string-append *public-url-base* args)))
|
`(href ,(string-append "/" (encode-and-join-uri-path
|
||||||
|
(append *public-path-base* args)))))
|
||||||
(define (list-join l infix)
|
(define (list-join l infix)
|
||||||
"Infixes @var{infix} into list @var{l}."
|
"Infixes @var{infix} into list @var{l}."
|
||||||
(if (null? l) l
|
(if (null? l) l
|
||||||
|
@ -47,7 +50,7 @@
|
||||||
*navbar-links*)
|
*navbar-links*)
|
||||||
*navbar-infix*)))))
|
*navbar-infix*)))))
|
||||||
`(html
|
`(html
|
||||||
(head (title ,(rref request 'title *title*))
|
(head (title ,title)
|
||||||
(meta (@ (name "Generator")
|
(meta (@ (name "Generator")
|
||||||
(content "An unholy concoction of parenthetical guile")))
|
(content "An unholy concoction of parenthetical guile")))
|
||||||
(link (@ (rel "stylesheet")
|
(link (@ (rel "stylesheet")
|
||||||
|
@ -59,8 +62,7 @@
|
||||||
(h1 (@ (id "header"))
|
(h1 (@ (id "header"))
|
||||||
(a (@ ,(href "")) ,*title*))
|
(a (@ ,(href "")) ,*title*))
|
||||||
,@(make-navbar)
|
,@(make-navbar)
|
||||||
(div (@ (id "content"))
|
(div (@ (id "content")) ,@body)
|
||||||
,@(rref request 'body '((p "(missing content?)"))))
|
|
||||||
(div (@ (id "footer"))
|
(div (@ (id "footer"))
|
||||||
"powered by "
|
"powered by "
|
||||||
(a (@ (href "http://wingolog.org/software/tekuti/"))
|
(a (@ (href "http://wingolog.org/software/tekuti/"))
|
||||||
|
|
Loading…
Reference in a new issue