Copyright | (c) 2011 Simon Meier |
---|---|
License | GPL v3 (see LICENSE) |
Maintainer | Simon Meier <iridcode@gmail.com> |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
Text.PrettyPrint.Html
Description
Pretty-printing with support for HTML markup and proper HTML escaping.
- class HighlightDocument d => HtmlDocument d where
- 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 where #
Minimal complete definition
Methods
unescapedText :: String -> d #
unescapedText str
converts the String
str
to a document without
performing any escaping.
unescapedZeroWidthText :: String -> d #
unescapedZeroWidthText str
converts the String
str
to a document
with zero width without performing any escaping.
Instances
Document d => HtmlDocument (HtmlDoc d) # | |
withTag :: HtmlDocument d => String -> [(String, String)] -> d -> d #
withTag tag attrs inner
adds the tag tag
with the attributes
attrs
around the inner
document.
withTagNonEmpty :: HtmlDocument d => String -> [(String, String)] -> d -> d #
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)] -> d #
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.
Wrap a document such that HTML markup can be added without disturbing the layout.
getHtmlDoc :: HtmlDoc d -> d #
postprocessHtmlDoc :: String -> String #
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 -> String #
renderHtmlDoc =postprocessHtmlDoc
.render
.getHtmlDoc
NoHtmlDoc: ignoring HTML markup
noHtmlDoc :: d -> NoHtmlDoc d #
Wrap a document such that all HtmlDocument
specific methods are ignored.
getNoHtmlDoc :: NoHtmlDoc d -> d #
Extract the wrapped document.