tamarin-prover-utils-1.2.2: Utility library for the tamarin prover.

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

Contents

- HtmlDocument class
- HtmlDoc: adding HTML markup
- NoHtmlDoc: ignoring HTML markup

Description

Pretty-printing with support for HTML markup and proper HTML escaping.

Synopsis

- 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

unescapedText, unescapedZeroWidthText

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) # |
Methods unescapedText :: String -> HtmlDoc d # unescapedZeroWidthText :: String -> 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

data HtmlDoc d #

A `Document` transformer that adds proper HTML escaping.

Instances

Monoid d => Monoid (HtmlDoc d) # |
Methods mempty :: HtmlDoc d # mappend :: HtmlDoc d -> HtmlDoc d -> HtmlDoc d # mconcat :: [HtmlDoc d] -> HtmlDoc d #
NFData d => NFData (HtmlDoc d) # |
Methods rnf :: HtmlDoc d -> () #
Document d => Document (HtmlDoc d) # |
Methods char :: Char -> HtmlDoc d # text :: String -> HtmlDoc d # zeroWidthText :: String -> HtmlDoc d # (<->) :: HtmlDoc d -> HtmlDoc d -> HtmlDoc d # hcat :: [HtmlDoc d] -> HtmlDoc d # hsep :: [HtmlDoc d] -> HtmlDoc d # ($$) :: HtmlDoc d -> HtmlDoc d -> HtmlDoc d # ($-$) :: HtmlDoc d -> HtmlDoc d -> HtmlDoc d # vcat :: [HtmlDoc d] -> HtmlDoc d # sep :: [HtmlDoc d] -> HtmlDoc d # cat :: [HtmlDoc d] -> HtmlDoc d # fsep :: [HtmlDoc d] -> HtmlDoc d # fcat :: [HtmlDoc d] -> HtmlDoc d # nest :: Int -> HtmlDoc d -> HtmlDoc d # caseEmptyDoc :: HtmlDoc d -> HtmlDoc d -> HtmlDoc d -> HtmlDoc d #
Document d => HighlightDocument (HtmlDoc d) # |
Methods highlight :: HighlightStyle -> HtmlDoc d -> HtmlDoc d #
Document d => HtmlDocument (HtmlDoc d) # |
Methods unescapedText :: String -> HtmlDoc d # unescapedZeroWidthText :: String -> HtmlDoc d #

htmlDoc :: d -> HtmlDoc d #

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 `&nbsp;`.

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.