[plt-scheme] Re: pretty html source

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Nov 14 06:56:26 EST 2008

On Nov 14, Dave Gurnell wrote:
> Dave Herman's PPrint package would be good for this sort of
> thing. It should only take 30 mins or so to knock up a first version
> using that and scheme/match.
> I'm definitely considering building this into Mirrors. Code
> contributions and Trac feature requests welcome :)

That's much more difficult than it sounds...  It's easy to do
something simple -- actually, the xml collection *can* print stuff
with indentation:

  (display-xml/content (xexpr->xml '(p (ul (li "foo") (li "bar")))))

but it doesn't take into account places where you shouldn't add
whitespaces (like after "<li>" and before "</li>" in that example).  I
have some code that prints things indented and does not mess things
up, but it was difficult write.  My excuse for that was that I'll be
writing scripts that will output htmls that people will later edit,
but in retrospect it's really not worth the effort (the indentation
doesn't look like it makes sense when it's correct).

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.