gdritter repos when-computer / 7c8e60a
Fixed atom feed and modified generated HTML Getty Ritter 8 years ago
2 changed file(s) with 19 addition(s) and 4 deletion(s). Collapse all Expand all
120120 (simple-tag 'h1)
121121 (simple-tag 'h2)
122122 (list-tag 'sub)
123 (list-tag 'p)
123 (cons 'p (lambda (n) `(div (@ (class para)) ,@n)))
124124 (list-tag 'ul)
125125 (list-tag 'ol)
126126 (simple-tag 'blockquote)
188188 (define (string->sexp str)
189189 (call-with-input-string str read))
190190
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
191203 (define (telml->sxml telml tags)
192204 (define (rec arg)
193 (cond ((string? arg) arg)
205 (cond ((string? arg) (escape-chars arg))
194206 ((symbol? (car arg))
195207 (let ((args (map rec (cdr arg)))
196208 (func (assoc (car arg) tags)))
208220 (make-telml-doc
209221 (if meta (apply make-meta (string->sexp meta)) '())
210222 (map (lambda (x)
211 (cons 'p (rec x)))
223 `(div (@ (class para)) ,(rec x)))
212224 (gather-para body)))))
213225
214226 (define (translate-file filename)
2424
2525 (define (atom-feed posts)
2626 (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"))
2828 (title "what happens when computer")
2929 (link (@ (href "http://what.happens.when.computer/feed.xml")
3030 (rel "self")))
9696
9797 ((// (= class tags) ul)
9898 (display inline))
99
100 ((= class para)
101 (padding-top 20px))
99102
100103 ((= class tag:before)
101104 (content "\"#\""))