diff options
Diffstat (limited to 'pastiche.lisp')
-rw-r--r-- | pastiche.lisp | 50 |
1 files changed, 46 insertions, 4 deletions
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 := (<html> (<body> - <br> - (<a> (@ :href (http:route-to 'raw-paste :id id)) - "raw") - (<h4> (title paste)) + ($ :padding "0" :margin "0" :background "#9cadaf") + + (html:<vert> + ($ :padding "8px") + (<a> + ($ :color "blue" :font-size "1.6em") + (@ :href (http:route-to 'raw-paste :id id)) + "raw") + (<div> + (<span> + ($ :text-decoration "underline" + :font-size "2.1em" + :font-weight "bold") + (<code> (title paste))) + (<span> + ($ :font-style "italic" :margin-left "2em") + (decoded-time (paste-time paste))))) (<pre> + ($ :font-size "1.2em" + :color "#dfba3b"; "#22ee44" + :background "#111111") (escape-html-in-paste-content content)))) (html:html-string page :pretty nil))) |