Improve appearance
modules/pastebin/httpserver.scm
| 57 | 57 | parts)) | |
| 58 | 58 | ||
| 59 | 59 | (define (templatize title body) | |
| 60 | - | `(html (head | |
| 60 | + | `(html (@ (lang "en")) | |
| 61 | + | (head | |
| 61 | 62 | (title ,title) | |
| 62 | - | (meta (@ (name "viewport") (content "width=device-width, initial-scale=1")))) | |
| 63 | + | (meta (@ (charset "utf-8"))) | |
| 64 | + | (meta (@ (name "viewport") (content "width=device-width, initial-scale=1.0"))) | |
| 65 | + | (link (@ (rel "stylesheet") (href "https://unpkg.com/simpledotcss/simple.min.css")))) | |
| 63 | 66 | (body ,@body))) | |
| 64 | 67 | ||
| 65 | 68 | (define (post-handler request request-body pb-data-path) | |
… | |||
| 158 | 161 | data-path | |
| 159 | 162 | (lambda (pb-data) (pb-data-get-top pb-data 5)))) | |
| 160 | 163 | (sxml (templatize | |
| 161 | - | "pastebin" | |
| 162 | - | `((form (@ (method "post") (enctype "multipart/form-data") | |
| 163 | - | (action "/post")) | |
| 164 | - | (textarea (@ (name "text")) "") | |
| 165 | - | (input (@ (type "checkbox") (name "showUrl") | |
| 166 | - | (id "showUrl") (value "1"))) | |
| 167 | - | (label (@ (for "showUrl")) "Show raw URL after paste") | |
| 168 | - | (input (@ (type "submit")))) | |
| 169 | - | (table (@ (border 1)) (tr (th "id") (th "text") (th "")) | |
| 170 | - | ,(map (lambda (entry) | |
| 171 | - | `(tr (td ,(pb-entry-id entry)) | |
| 172 | - | (td ,(pb-entry-text entry)) | |
| 173 | - | (td | |
| 174 | - | (a (@ (href | |
| 175 | - | ,(format #f "/raw/~a" | |
| 176 | - | (pb-entry-id entry)))) | |
| 177 | - | "raw")))) | |
| 178 | - | top5)))))) | |
| 164 | + | "Pastebin" | |
| 165 | + | `((header (h1 "Pastebin")) | |
| 166 | + | (main (section (h2 "Recent") | |
| 167 | + | ,(map (lambda (entry) | |
| 168 | + | `(article (h3 (a (@ (href ,(format #f "/raw/~a" (pb-entry-id entry))) | |
| 169 | + | (target "_blank")) | |
| 170 | + | ,(pb-entry-id entry))) | |
| 171 | + | (pre ,(pb-entry-text entry)))) | |
| 172 | + | top5)) | |
| 173 | + | (section (h2 "New") | |
| 174 | + | (form (@ (method "post") | |
| 175 | + | (enctype "multipart/form-data") | |
| 176 | + | (action "/post")) | |
| 177 | + | (p (label "Paste content" | |
| 178 | + | (textarea (@ (name "text")) ""))) | |
| 179 | + | (p (label (input (@ (type "checkbox") | |
| 180 | + | (name "showUrl") | |
| 181 | + | (value "1"))) | |
| 182 | + | "Show raw URL after paste")) | |
| 183 | + | (input (@ (type "submit")))))) | |
| 184 | + | (footer (p (a (@ (href "https://github.com/pisemsky/guile-pastebin") | |
| 185 | + | (target "_blank")) | |
| 186 | + | "Source code"))))))) | |
| 179 | 187 | (display "<!DOCTYPE html>\n" port) | |
| 180 | 188 | (sxml->xml sxml port)))))))) | |