| 1 |
(require-extension sxml-serializer)
|
| 2 |
(require-extension scss)
|
| 3 |
(require-extension matchable)
|
| 4 |
|
| 5 |
(define (pairs lst)
|
| 6 |
(match lst
|
| 7 |
[ (x . (y . rst)) (cons (list x y) (pairs rst)) ]
|
| 8 |
[ _ '() ]))
|
| 9 |
|
| 10 |
;; template-ey things and style things
|
| 11 |
|
| 12 |
(define stylesheet
|
| 13 |
'(css
|
| 14 |
(body
|
| 15 |
(font-family "\"Arial\", \"Helvetica\", sans-serif")
|
| 16 |
(font-size 15pt))
|
| 17 |
|
| 18 |
((= class all)
|
| 19 |
(width 600px)
|
| 20 |
(margin-left auto)
|
| 21 |
(margin-right auto)
|
| 22 |
(text-align center))
|
| 23 |
|
| 24 |
((= class menu)
|
| 25 |
(color "#0f0f0f"))
|
| 26 |
|
| 27 |
((= class menu-index:before) (content "\"/ \""))
|
| 28 |
((= class menu-archive:before) (content "\"^ \""))
|
| 29 |
((= class menu-tags:before) (content "\"# \""))
|
| 30 |
((= class menu-about:before) (content "\"@ \""))
|
| 31 |
|
| 32 |
((// (= class navlist) li)
|
| 33 |
(display inline)
|
| 34 |
(list-style-type none)
|
| 35 |
(padding-left 10px)
|
| 36 |
(padding-right 20px))
|
| 37 |
|
| 38 |
((// (= class navlist) ul)
|
| 39 |
(padding-left 100px)
|
| 40 |
(padding-right 100px))))
|
| 41 |
|
| 42 |
(define menu
|
| 43 |
(let ((menu-item
|
| 44 |
(lambda (name url)
|
| 45 |
`(li (@ (class ,(string-append "menu-" name)))
|
| 46 |
(a (@ (href ,url)) ,name)))))
|
| 47 |
`(ul (@ (class navlist))
|
| 48 |
,(menu-item "index" "/")
|
| 49 |
,(menu-item "archive" "/archive/")
|
| 50 |
,(menu-item "tags" "/tags/")
|
| 51 |
,(menu-item "about" "/about/"))))
|
| 52 |
|
| 53 |
(define (page title content)
|
| 54 |
`(html
|
| 55 |
(head
|
| 56 |
(meta (@ (http-equiv "Content-Type")
|
| 57 |
(content "application/xhtml+xml; charset=utf-8;")))
|
| 58 |
(style (@ (type "text/css")) ,(scss->css stylesheet))
|
| 59 |
(title ,(string-append "what happens when computer: " title)))
|
| 60 |
(div (@ (class "all"))
|
| 61 |
(div (@ (class "header"))
|
| 62 |
(h1 "what happens when computer"))
|
| 63 |
(div (@ (class "nav")) ,menu)
|
| 64 |
(div (@ (class "main")) ,content)
|
| 65 |
(div (@ (class "footer")) "© 2015 getty ritter"))))
|
| 66 |
|
| 67 |
(display (serialize-sxml (apply page (command-line-arguments))))
|