From 0d4fc4e5011c6a3c5ca29b26abac5762dae48a49 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sat, 13 Nov 2010 19:08:59 +0100 Subject: 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. --- tekuti/template.scm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tekuti/template.scm b/tekuti/template.scm index 9185b8e..759f08e 100644 --- a/tekuti/template.scm +++ b/tekuti/template.scm @@ -1,5 +1,5 @@ ;; Tekuti -;; Copyright (C) 2008 Andy Wingo +;; Copyright (C) 2008, 2010 Andy Wingo ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -25,13 +25,16 @@ ;;; Code: (define-module (tekuti template) - #:use-module (tekuti request) + #:use-module (web uri) #:use-module (tekuti config) #:export (templatize)) -(define (templatize request) +(define* (templatize #:key + (title *title*) + (body '((p "(missing content?)")))) (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) "Infixes @var{infix} into list @var{l}." (if (null? l) l @@ -47,7 +50,7 @@ *navbar-links*) *navbar-infix*))))) `(html - (head (title ,(rref request 'title *title*)) + (head (title ,title) (meta (@ (name "Generator") (content "An unholy concoction of parenthetical guile"))) (link (@ (rel "stylesheet") @@ -59,8 +62,7 @@ (h1 (@ (id "header")) (a (@ ,(href "")) ,*title*)) ,@(make-navbar) - (div (@ (id "content")) - ,@(rref request 'body '((p "(missing content?)")))) + (div (@ (id "content")) ,@body) (div (@ (id "footer")) "powered by " (a (@ (href "http://wingolog.org/software/tekuti/")) -- cgit v1.2.3-54-g00ecf