Safe Haskell | None |
---|---|
Language | Haskell98 |
Very fast TagSoup parser.
Works only with strict bytestrings.
Correctly handles HTML <script>
and <style>
tags.
This module is intended to be used in conjunction with the original tagsoup
package:
import Text.HTML.TagSoup hiding (parseTags, renderTags) import Text.HTML.TagSoup.Fast
Remark that tags are returned in lower case and comments are not returned.
In long running multithreaded applications it's generally recommended to use
parseTagsT
and work with [
Tag
Text
]
to reduce memory fragmentation.
- parseTags :: ByteString -> [Tag ByteString]
- renderTags :: [Tag ByteString] -> ByteString
- parseTagsT :: ByteString -> [Tag Text]
- renderTagsT :: [Tag Text] -> Text
- ensureUtf8Xml :: ByteString -> ByteString
- escapeHtml :: ByteString -> ByteString
- escapeHtmlT :: Text -> Text
- unescapeHtml :: ByteString -> ByteString
- unescapeHtmlT :: Text -> Text
Documentation
parseTags :: ByteString -> [Tag ByteString] Source #
Parse a string to a list of tags.
parseTags "<div>&<script>x<y</script>" == [TagOpen "div" [],TagText "&",TagOpen "script" [],TagText "x<y",TagClose "script"]
renderTags :: [Tag ByteString] -> ByteString Source #
Show a list of tags, as they might have been parsed.
parseTagsT :: ByteString -> [Tag Text] Source #
Alternative to parseTags
working with Text
renderTagsT :: [Tag Text] -> Text Source #
Alternative to renderTags
working with Text
ensureUtf8Xml :: ByteString -> ByteString Source #
Decode XML to UTF-8 using encoding
attribute of <?xml>
tag.
escapeHtml :: ByteString -> ByteString Source #
Escape characters unsafe to HTML
escapeHtmlT :: Text -> Text Source #
Alternative to escapeHtml
working with Text
unescapeHtml :: ByteString -> ByteString Source #
Convert escaped HTML to raw.
unescapeHtmlT :: Text -> Text Source #
Alternative to unescapeHtml
working with Text