better html rendering

This commit is contained in:
Spencer Florence 2014-12-30 11:03:49 -06:00
parent e622bffcd5
commit 235602763a

View File

@ -69,10 +69,20 @@
(values mode last-start))]))) (values mode last-start))])))
mode) mode)
(define (encode-string c) (define (encode-string s)
(foldr (λ (el rst) (cons el (cons '(br ()) rst))) (reverse
'() (for/fold ([r null]) ([c s])
(string-split c "\n"))) (cons
(case c
[(#\space) 'nbsp]
[(#\newline) '(br ())]
[else (string c)])
r))))
(module+ test
(check-equal? (encode-string " ")
'(nbsp))
(check-equal? (encode-string "\n")
'((br ()))))
(define (mode-xml mode body) (define (mode-xml mode body)
(define color (define color