From 74ac5c16b70077e5e395b8dee9d05f5b688a93d9 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Sat, 22 Jun 2024 14:24:55 +0200 Subject: [PATCH] Split body in header an main macros --- src/main.lisp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/main.lisp b/src/main.lisp index eec94c5..4e419cf 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -153,20 +153,28 @@ Example usage: ,@(loop for url in add-css-urls collect `(:link :type "text/css" :rel "stylesheet" :href ,url))) - (:body + (:body ,@body) - (:div :class "container text-center py-3" - (:a :href "#main-content" - :class "skip-link" - (find-l10n "skip-link" *html-lang* *l10n*))) + (:script :src ,(bs-url-js)) + ,@(loop for url in add-js-urls + collect `(:script :src ,url))))) - (:h1 :class "visually-hidden" ,title) - (:main :id "main-content" - ,@(if main-con (list :class "container") nil) ,@body) +(defmacro body-header (main-heading &body body) + `(spinneret:with-html + (:header + (:div :class "container text-center py-3" + (:a :href "#main-content" + :class "skip-link" + (find-l10n "skip-link" *html-lang* *l10n*))) + ,@body + (:h1 ,main-heading)))) + +(defmacro body-main (&optional main-con &body body) + `(spinneret:with-html + (:main :id "main-content" + ,@(when main-con (list :class "container")) + ,@body))) - (:script :src ,(bs-url-js)) - ,@(loop for url in add-js-urls - collect `(:script :src ,url)))))) (defun remove-special-chars (str) "Removes all special characters from the string STR except numbers and alphabets.