html-proc.rkt 481 B

1234567891011121314151617181920212223
  1. #lang racket
  2. (require xml
  3. web-server/servlet)
  4. (provide finalize-html-content)
  5. (define (add-doctype html-string)
  6. (string-append "<!DOCTYPE html>\n"
  7. html-string))
  8. ;; expects a single xexpr
  9. ;; + converts to string
  10. ;; + adds html doctype
  11. (define (finalize-html-content html-content)
  12. (add-doctype (xexpr->string html-content)))
  13. (define (xexpr->xml-string-pretty x)
  14. (with-output-to-string
  15. (λ ()
  16. (display-xml/content
  17. (xexpr->xml x)))))