From ccbb164eec042cb37babb3bff8e240284c9eda50 Mon Sep 17 00:00:00 2001 From: colin Date: Sat, 23 Sep 2023 08:42:05 -0700 Subject: changed default theme sample display file to lisp --- fussy.lisp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/fussy.lisp b/fussy.lisp index 122d9b9..94fc532 100644 --- a/fussy.lisp +++ b/fussy.lisp @@ -354,12 +354,20 @@ that they are not loaded during image gen.") (string-downcase (theme-pkg-name (theme-package theme))) theme))) -(defun theme-preview-image-path (theme &optional variant) +(defun theme-preview-image-path (theme &optional (variant "lisp")) (assert (theme-p theme)) - (format nil "/images/~a/~a/~a.svg" - (string-downcase (theme-pkg-name (theme-package theme))) - theme - (or variant (pathname-name (first (image-files-for-theme theme)))))) + (let* ((image-files + (image-files-for-theme theme)) + (file + (or (find variant image-files + :key (a:compose #'pathname-type #'pathname-name) + :test #'string-equal) + (first image-files)))) + + (format nil "/images/~a/~a/~a.svg" + (string-downcase (theme-pkg-name (theme-package theme))) + theme + (pathname-name file)))) (defun the-update-time () (multiple-value-bind (sec min hour date month year) (get-decoded-time) @@ -449,7 +457,7 @@ that they are not loaded during image gen.") (:a :href (format-string pg) (format nil "~a" (1+ pg))) " "))))))) -(defun theme-preview-image (theme &optional variant) +(defun theme-preview-image (theme &optional (variant "lisp")) (html:with-html (:img :src (theme-preview-image-path theme variant)))) @@ -458,7 +466,7 @@ that they are not loaded during image gen.") (html:with-html (:div :class "card" (:a :href (url-path theme) (:h4 theme) - (theme-preview-image theme))))) + (theme-preview-image theme "lisp"))))) (defun package-preview-card (pkg) (let ((themes (themes-in-package pkg))) @@ -784,5 +792,5 @@ This procedure will error if lazybones:*request* is not currently bound." (:p "A theme in the package " (:a :href (url-path pkg) (package-namestring pkg)))) (:div :class "container" - (dolist (variant (mapcar #'pathname-name (image-files-for-theme theme))) + (dolist (variant '("lisp" "py" "cpp")) (theme-preview-image theme variant)))))))) -- cgit v1.2.3