From 7f616b7898300b70d84827e587c2ef805f6629e2 Mon Sep 17 00:00:00 2001 From: colin Date: Fri, 16 Aug 2024 19:32:15 -0700 Subject: Fussing with colors --- pastiche.lisp | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) (limited to 'pastiche.lisp') diff --git a/pastiche.lisp b/pastiche.lisp index 2d5a5d3..8fb1af6 100644 --- a/pastiche.lisp +++ b/pastiche.lisp @@ -183,6 +183,32 @@ from make-paste-filename.")) (a:read-file-into-string (merge-pathnames (filename paste) (paste-path*))))) +(def:const +days-of-the-week+ + #("Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday")) + +(defun dow-name (dow) + (elt +days-of-the-week+ dow)) + +(def:const +months+ + #("January" "February" "March" "April" "May" "June" + "July" "August" "September" "October" "November" "December")) + +(defun month-name (month) + (elt +months+ month)) + +(defun decoded-time (universal-time) + (multiple-value-bind + (sec min hr date month year dow) + (decode-universal-time universal-time) + (declare (ignore sec)) + (format nil "~a, ~a ~:R ~d at ~2,'0d:~2,'0d ~:[AM~;PM~]" + (dow-name dow) + (month-name month) + date + year + (mod hr 12) + min + (>= hr 12)))) (http:defendpoint view-paste :get :route "paste" (:id +paste-id-regex+) @@ -198,11 +224,27 @@ from make-paste-filename.")) content := (a:read-file-into-string filename) page := ( ( -
- ( (@ :href (http:route-to 'raw-paste :id id)) - "raw") - (

(title paste)) + ($ :padding "0" :margin "0" :background "#9cadaf") + + (html: + ($ :padding "8px") + ( + ($ :color "blue" :font-size "1.6em") + (@ :href (http:route-to 'raw-paste :id id)) + "raw") + (
+ ( + ($ :text-decoration "underline" + :font-size "2.1em" + :font-weight "bold") + ( (title paste))) + ( + ($ :font-style "italic" :margin-left "2em") + (decoded-time (paste-time paste))))) (
+               ($ :font-size "1.2em"
+                  :color "#dfba3b"; "#22ee44"
+                  :background "#111111")
                (escape-html-in-paste-content content))))
 
     (html:html-string page :pretty nil)))
-- 
cgit v1.2.3