Portability | portable |
---|---|
Maintainer | Simon Meier <iridcode@gmail.com> |
Safe Haskell | None |
Pretty-printing with support for HTML markup and proper HTML escaping.
- class HighlightDocument d => HtmlDocument d where
- unescapedText :: String -> d
- unescapedZeroWidthText :: String -> d
- withTag :: HtmlDocument d => String -> [(String, String)] -> d -> d
- withTagNonEmpty :: HtmlDocument d => String -> [(String, String)] -> d -> d
- closedTag :: HtmlDocument d => String -> [(String, String)] -> d
- module Text.PrettyPrint.Highlight
- data HtmlDoc d
- htmlDoc :: d -> HtmlDoc d
- getHtmlDoc :: HtmlDoc d -> d
- postprocessHtmlDoc :: String -> String
- renderHtmlDoc :: HtmlDoc Doc -> String
- noHtmlDoc :: d -> NoHtmlDoc d
- getNoHtmlDoc :: NoHtmlDoc d -> d
HtmlDocument class
class HighlightDocument d => HtmlDocument d whereSource
unescapedText :: String -> dSource
unescapedText str
converts the String
str
to a document without
performing any escaping.
unescapedZeroWidthText :: String -> dSource
unescapedZeroWidthText str
converts the String
str
to a document
with zero width without performing any escaping.
Document d => HtmlDocument (HtmlDoc d) |
withTag :: HtmlDocument d => String -> [(String, String)] -> d -> dSource
withTag tag attrs inner
adds the tag tag
with the attributes
attrs
around the inner
document.
withTagNonEmpty :: HtmlDocument d => String -> [(String, String)] -> d -> dSource
withTagNonEmpty tag attrs inner
adds the tag tag
with the attributes
attrs
around the inner
document iff inner
is a non-empty document.
closedTag :: HtmlDocument d => String -> [(String, String)] -> dSource
closedTag tag attrs
builds the closed tag tag
with the attributes
attrs
; e.g.,
closedTag "img" "href" "here" = HtmlDoc (text "<img href=\"here\"/>)
module Text.PrettyPrint.Highlight
HtmlDoc: adding HTML markup
A Document
transformer that adds proper HTML escaping.
htmlDoc :: d -> HtmlDoc dSource
Wrap a document such that HTML markup can be added without disturbing the layout.
getHtmlDoc :: HtmlDoc d -> dSource
postprocessHtmlDoc :: String -> StringSource
postprocessHtmlDoc cs
converts the line-breaks of cs
to br
tags and
the prefixed spaces in every line of cs
by non-breaing HTML spaces
.
renderHtmlDoc :: HtmlDoc Doc -> StringSource
renderHtmlDoc =postprocessHtmlDoc
.render
.getHtmlDoc
NoHtmlDoc: ignoring HTML markup
noHtmlDoc :: d -> NoHtmlDoc dSource
Wrap a document such that all HtmlDocument
specific methods are ignored.
getNoHtmlDoc :: NoHtmlDoc d -> dSource
Extract the wrapped document.