From 1a190832c44700a89fb1d55d2de1ca423089ae76 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 30 Jan 2015 08:29:26 -0500 Subject: view: html: Add render-stylesheet procedure. * guix-web/view/html.scm (render-stylesheet): New procedure. (main-layout): Use it. (stylesheets): New variable. --- guix-web/view/html.scm | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/guix-web/view/html.scm b/guix-web/view/html.scm index 4331692..7016ba8 100644 --- a/guix-web/view/html.scm +++ b/guix-web/view/html.scm @@ -58,22 +58,28 @@ (javascript "/js/routes.js" agpl3+))) (define (script-tag javascript) +(define stylesheets + (list "/css/bootstrap.css" + "/css/guix.css")) + `(script (@ (type "text/javascript") (src ,(javascript-source-uri javascript))) ;; hack to ensure closing tag "")) +(define (render-stylesheet stylesheet-uri) + `(link (@ (rel "stylesheet") + (href ,stylesheet-uri)))) + (define (main-layout subtitle body) - `(html - (head - (meta (@ (content "text/html;charset=utf-8") - (http-equiv "Content-Type"))) - (title ,(string-append "GNU Guix - " subtitle)) - (link (@ (rel "stylesheet") - (href "/css/bootstrap.css"))) - (link (@ (rel "stylesheet") - (href "/css/guix.css")))) - (body ,body))) + `((doctype "HTML") + (html + (head + (meta (@ (content "text/html;charset=utf-8") + (http-equiv "Content-Type"))) + (title ,(string-append "GNU Guix - " subtitle)) + ,@(map render-stylesheet stylesheets)) + (body ,body)))) (define (render-package-license package) (define (license-link license) -- cgit v1.2.3