From 5cc01e31b84ab464f04aacf282c4206a40534e7e Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Mon, 2 Dec 2024 16:55:09 +0100 Subject: [PATCH] Use local vars in with-page --- src/main.lisp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main.lisp b/src/main.lisp index 623d943..1e710fa 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -77,10 +77,6 @@ "bootstrap.bundle.min.js") "Constructs path for HTML to load local bootstrap js from disk.") -(defparameter *color-theme* "light") - -(defparameter *print-css-url* nil) - (defun bs-url-css () (if *use-cdn* *cdn-url-css* @@ -124,7 +120,10 @@ (defmacro with-page ((&key title + (lang "en") + (color-theme "light") meta + print-css-url add-css-urls add-js-urls) &body body) @@ -144,7 +143,8 @@ Example usage: (with-page (:meta (:author \"John Doe\") :title \"My Page\" :main-con t) \"foo\")" `(spinneret:with-html-string (:doctype) - (:html :data-bs-theme ,*color-theme* + (:html :lang ,lang + :data-bs-theme ,color-theme (:head (:meta :charset "utf-8") (:meta :name "viewport" :content "width=device-width, initial-scale=1") @@ -158,8 +158,8 @@ Example usage: (:title ,title) (:style (:raw "@media print{.navbar,.nav,.btn,.carousel,.dropdown-menu,footer,.no-print{display:none!important}.container,.container-fluid{width:100%!important;padding:0!important;margin:0!important}[class^=\"col-\"]{width:100%!important;flex:0 0 100%!important;max-width:100%!important}body{font-size:12pt;line-height:1.5}h1,.h1{font-size:24pt}h2,.h2{font-size:22pt}h3,.h3{font-size:20pt}h4,.h4{font-size:18pt}h5,.h5{font-size:16pt}h6,.h6{font-size:14pt}h1,h2,h3,h4,h5,h6,p,img,table,figure{page-break-inside:avoid}a{text-decoration:underline;color:#000!important}a[href^=\"http\"]:after{content:\" (\" attr(href) \")\";font-size:80%}.table-responsive{overflow:visible!important}.card{border:none!important;box-shadow:none!important}@page{margin:1in}}")) - (when *print-css-url* (:link :type "text/css" :rel "stylesheet" :href ,*print-css-url*)) - (:link :type "text/css" :rel "stylesheet" :href ,(bs-url-css)) + (when ,print-css-url (:link :type "text/css" :rel "stylesheet" :href ,print-css-url)) + (:link :type "text/css" :rel "stylesheet" :href (bs-url-css)) ,@(loop for url in add-css-urls collect `(:link :type "text/css" :rel "stylesheet" :href ,url)) @@ -168,7 +168,7 @@ Example usage: (:body ,@body) - (:script :src ,(bs-url-js)) + (:script :src (bs-url-js)) ,@(loop for url in add-js-urls collect `(:script :src ,url)))))