Re-structure code and update the use of widgets

This commit is contained in:
Marcus Kammer 2025-01-23 16:06:39 +01:00
parent 278f99e17a
commit 0b9abc2d4a

View file

@ -13,7 +13,9 @@
(:import-from #:ml-sbt/navbar (:import-from #:ml-sbt/navbar
#:with-navbar) #:with-navbar)
(:import-from #:ml-sbt/list-group (:import-from #:ml-sbt/list-group
#:with-list-group) #:list-group
#:with-list-group
#:with-list-group*)
(:import-from #:ml-sbt/card (:import-from #:ml-sbt/card
#:with-card*) #:with-card*)
(:import-from #:ml-sbt/btn (:import-from #:ml-sbt/btn
@ -24,21 +26,21 @@
(defvar *lang* "en") (defvar *lang* "en")
(defparameter *active-projects* (defparameter *active-projects*
'((:header "metalisp.sbt" '(("metalisp.sbt"
:items ("Library of Common Lisp Macros to generate HTML for Bootstrap CSS." "In Active Development" "Common Lisp") ("Library of Common Lisp Macros to generate HTML." "In Active Development" "Common Lisp")
:url "https://code.metalisp.dev/marcuskammer/dev.metalisp.sbt") "https://code.metalisp.dev/marcuskammer/dev.metalisp.sbt")
(:header "metalisp.survey" ("metalisp.survey"
:items ("Create questionnaires and analyze the results." "In Active Development" "Common Lisp") ("Create questionnaires and analyze the results." "In Active Development" "Common Lisp")
:url "https://code.metalisp.dev/marcuskammer/dev.metalisp.survey") "https://code.metalisp.dev/marcuskammer/dev.metalisp.survey")
(:header "metalisp.qmetrics" ("metalisp.qmetrics"
:items ("Calculation engine for questionnaires." "In Active Development" "Common Lisp") ("Calculation engine for questionnaires." "In Active Development" "Common Lisp")
:url "https://code.metalisp.dev/marcuskammer/dev.metalisp.qmetrics") "https://code.metalisp.dev/marcuskammer/dev.metalisp.qmetrics")
(:header "metalisp.activitystreams" ("metalisp.activitystreams"
:items ("ActivityStreams 2 library" "In Active Development" "Common Lisp") ("ActivityStreams 2 library" "In Active Development" "Common Lisp")
:url "https://code.metalisp.dev/marcuskammer/dev.metalisp.activitystreams") "https://code.metalisp.dev/marcuskammer/dev.metalisp.activitystreams")
(:header "emacs dot files" ("emacs dot files"
:items ("Personal emacs dot files." "In Active Development" "Emacs Lisp") ("Personal emacs dot files." "In Active Development" "Emacs Lisp")
:url "https://code.metalisp.dev/marcuskammer/emacs.d"))) "https://code.metalisp.dev/marcuskammer/emacs.d")))
(defun md-to-html-string (markdown-string) (defun md-to-html-string (markdown-string)
(with-output-to-string (s) (with-output-to-string (s)
@ -48,8 +50,11 @@
(with-output-to-string (s) (with-output-to-string (s)
(3bmd:parse-and-print-to-stream input-file s))) (3bmd:parse-and-print-to-stream input-file s)))
(with-open-file (ofile "public/index.html" :direction :output :if-exists :supersede) (unless (uiop:directory-exists-p #P"public/")
(let ((html (with-page (:title "metalisp.dev projects") (uiop:ensure-all-directories-exist '(#P"public/")))
(defparameter *index-html*
(with-page (:title "metalisp.dev projects")
(with-body-header nil "Crafting Software with the Power of Lisp" *lang* (with-body-header nil "Crafting Software with the Power of Lisp" *lang*
(with-navbar nil "metalisp" "/" nil nil)) (with-navbar nil "metalisp" "/" nil nil))
(with-body-main nil (with-body-main nil
@ -66,15 +71,18 @@
(with-title-bar "Active Projects") (with-title-bar "Active Projects")
(with-section-row (with-section-row
(dolist (project *active-projects*) (dolist (project *active-projects*)
(destructuring-bind (cheader citems curl) project
(with-card* (with-card*
:card-header (getf project :header) :card-header cheader
:card-items (getf project :items) :card-items citems
:card-body (btn (:url (getf project :url)) :card-body (btn (:url curl) (t9n "view-details" *lang*)))))))
(t9n "view-details" *lang*))))))
;; Contact ;; Contact
(with-section (with-section
(with-title-bar "Contact") (with-title-bar "Contact")
(with-list-group '(("email: post at metalisp.dev") (with-list-group nil
("jabber groupchat: metalisp@conference.mailbox.org") "email: post at metalisp.dev"
(:a :rel "me" :href "https://fosstodon.org/@metalisp" "Mastodon")))))))) "jabber chatgroup: metalisp@conference.mailbox.org"
(princ html ofile))) (:a :rel "me" :href "https://fosstodon.org/@metalisp" "Mastodon"))))))
(with-open-file (ofile "public/index.html" :direction :output :if-exists :supersede)
(princ *index-html* ofile))