[plt-scheme] Beautify (auto-)generated HTML-Code of servlets

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Wed Jan 3 17:20:58 EST 2007

> I just started to create a homepage using the plt-web-server to learn 
> scheme. I really like the way htmlcode is build by `(html (body.... but 
> in the end the whole side is in one single line. So my question: is 
> there a way to make the web-server automatically beautify the HTML-code 
> with linebreaks or even autoindention?

Hi Stefan,

The pretty-printing library "pretty.ss" may be useful here.

http://download.plt-scheme.org/doc/360/html/mzlib/mzlib-Z-H-35.html#node_chap_35

For example:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> (require (lib "pretty.ss"))
> (pretty-print '(html (head (title "hello")) (body (p "this is a test 
hello world this is meant to be long"))))
(html
  (head (title "hello"))
  (body (p "this is a test hello world this is meant to be long")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Posted on the users mailing list.