Fixed atom feed and modified generated HTML
Getty Ritter
8 years ago
120 | 120 |
(simple-tag 'h1)
|
121 | 121 |
(simple-tag 'h2)
|
122 | 122 |
(list-tag 'sub)
|
123 | |
(list-tag 'p)
|
| 123 |
(cons 'p (lambda (n) `(div (@ (class para)) ,@n)))
|
124 | 124 |
(list-tag 'ul)
|
125 | 125 |
(list-tag 'ol)
|
126 | 126 |
(simple-tag 'blockquote)
|
|
188 | 188 |
(define (string->sexp str)
|
189 | 189 |
(call-with-input-string str read))
|
190 | 190 |
|
| 191 |
(define (escape-chars str)
|
| 192 |
(define (go c rest)
|
| 193 |
(cond
|
| 194 |
((eq? c #\<)
|
| 195 |
(cons #\; (cons #\t (cons #\l (cons #\& rest)))))
|
| 196 |
((eq? c #\>)
|
| 197 |
(cons #\; (cons #\t (cons #\g (cons #\& rest)))))
|
| 198 |
((eq? c #\&)
|
| 199 |
(cons #\; (cons #\p (cons #\m (cons #\a (cons #\& rest))))))
|
| 200 |
(else (cons c rest))))
|
| 201 |
(reverse-list->string (string-fold go '() str)))
|
| 202 |
|
191 | 203 |
(define (telml->sxml telml tags)
|
192 | 204 |
(define (rec arg)
|
193 | |
(cond ((string? arg) arg)
|
| 205 |
(cond ((string? arg) (escape-chars arg))
|
194 | 206 |
((symbol? (car arg))
|
195 | 207 |
(let ((args (map rec (cdr arg)))
|
196 | 208 |
(func (assoc (car arg) tags)))
|
|
208 | 220 |
(make-telml-doc
|
209 | 221 |
(if meta (apply make-meta (string->sexp meta)) '())
|
210 | 222 |
(map (lambda (x)
|
211 | |
(cons 'p (rec x)))
|
| 223 |
`(div (@ (class para)) ,(rec x)))
|
212 | 224 |
(gather-para body)))))
|
213 | 225 |
|
214 | 226 |
(define (translate-file filename)
|
24 | 24 |
|
25 | 25 |
(define (atom-feed posts)
|
26 | 26 |
(let ((updated (date->tz (post-time (car posts)))))
|
27 | |
`(feed (@ (xmlns "htpt://www.w3.org/2005/Atom"))
|
| 27 |
`(feed (@ (xmlns "http://www.w3.org/2005/Atom"))
|
28 | 28 |
(title "what happens when computer")
|
29 | 29 |
(link (@ (href "http://what.happens.when.computer/feed.xml")
|
30 | 30 |
(rel "self")))
|
|
96 | 96 |
|
97 | 97 |
((// (= class tags) ul)
|
98 | 98 |
(display inline))
|
| 99 |
|
| 100 |
((= class para)
|
| 101 |
(padding-top 20px))
|
99 | 102 |
|
100 | 103 |
((= class tag:before)
|
101 | 104 |
(content "\"#\""))
|