-- |Pretty-printer for HTML. This modules exports no names. It only defines -- instances of 'PrettyPrintable' for HTML. module BrownPLT.Html.PrettyPrint ( html , renderHtml ) where import qualified Data.List as List import qualified Data.Char as Char import Text.PrettyPrint.HughesPJ import BrownPLT.Html.Syntax renderHtml :: Script s => Html a s -> String renderHtml = render.html vert [] = empty vert [doc] = doc vert (doc:docs) = doc <> text "" <> vert docs attr :: Script s => Attribute a s -> Doc attr a = case a of Attribute name value _ -> text name <> equals <> doubleQuotes (text value) AttributeExpr _ n v "" -> text n <> equals <> text "{!" <+> prettyPrintScript v <+> text "!}" AttributeExpr _ n v d -> text n <> equals <> text "{!" <+> prettyPrintScript v <+> text "|||" <+> text d <+> text "!}" html :: Script s => Html a s -> Doc html x = case x of -- The . --