(defmacro with-html (&body body) "quick wrapper around cl-who:with-html-output" `(cl-who:with-html-output (s *html-output-stream*) ,@body)) (defmacro def-html (name doc-string &body body) "Quick macro to create functions of certain names which start with (with-html ..)" `(defun ,name () ,doc-string (with-html ,@body))) (defmacro content-html (content) `(with-html (:main :class "wrapper" (:section :class "container" :id "header" (:img :class "img" :src ,(website-standard-image) :height "45") ,@content)))) (def-html footer-for-webpages "Generates the constant footer for the webpages" (:div :class "footer" (:p "Made with Common Lisp and Hunchentoot")) ; (:script :src "/libraries/validate/jquery.validate.js") (:script :src "/scripts/hash-passwords-on-click.js") (:script :src "/scripts/validate-submission.js")) (defun basic-header () "Generates a basic header with no scripts and nothing special except css basically" (cl-who:with-html-output (x *html-output-stream* :prologue t) (:head (:meta :charset "utf-8") (:meta :http-equiv "X-UA-COMPATIBLE" :content "IE=edge") (:meta :name "viewport" :content "width=device-width, initial-scale=1") (:link :rel "stylesheet" :href "/css/roboto300.css") (:link :rel "stylesheet" :href "/css/normalize.css") (:link :rel "stylesheet" :href "/css/milligram.min.css") (:link :rel "stylesheet" :type "text/css" :href "/css/main.css")))) (defun header-for-webpages () "Generates the constant header for the webpages" (cl-who:with-html-output (x *html-output-stream* :prologue t) (:head ;(:noscript (:meta :http-equiv "refresh" ; :content 0 ; :URL "/nojs") ;(:style "html{display:none;}")) (:meta :charset "utf-8") (:meta :http-equiv "X-UA-COMPATIBLE" :content "IE=edge") (:meta :name "viewport" :content "width=device-width, initial-scale=1") (:script :src "/libraries/jquery/jquery-3.3.1.js") (:script :src "/libraries/validate/jquery.validate.js") (:script :src "/libraries/sha512/sha512.js") (:link :rel "stylesheet" :href "/css/roboto300.css") (:link :rel "stylesheet" :href "/css/normalize.css") (:link :rel "stylesheet" :href "/css/milligram.min.css") (:link :rel "stylesheet" :type "text/css" :href "/css/main.css")))) ;;(home login users register) (generate-navigation-bar ((home "/") logout));;nav bar with only home as an option and the url "/" ;;generates a function called (navigation-bar) (defmacro def-basic-page (name doc-string nav-keys &body body) "Same as def-page but uses basic-header instead" `(def-html ,name ,doc-string (basic-header) (navigation-bar ,@nav-keys) ,@body (footer-for-webpages))) (defmacro def-page (name doc-string nav-keys &body body) "Macro which just puts the building blocks of a webpage together" `(def-html ,name ,doc-string (header-for-webpages) (navigation-bar ,@nav-keys) ,@body (footer-for-webpages)))