fast-tagsoup 1.0.2 → 1.0.3
raw patch · 2 files changed
+13/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Text.HTML.TagSoup.Fast: escapeHtml :: ByteString -> ByteString
+ Text.HTML.TagSoup.Fast: escapeHtmlT :: Text -> Text
+ Text.HTML.TagSoup.Fast: unescapeHtml :: ByteString -> ByteString
+ Text.HTML.TagSoup.Fast: unescapeHtmlT :: Text -> Text
Files
- Text/HTML/TagSoup/Fast.hs +12/−1
- fast-tagsoup.cabal +1/−1
Text/HTML/TagSoup/Fast.hs view
@@ -17,7 +17,9 @@ 'parseTagsT' and work with @[@'Tag' 'Text'@]@ to reduce memory fragmentation. -} module Text.HTML.TagSoup.Fast- ( parseTags, renderTags, parseTagsT, renderTagsT, ensureUtf8Xml )+ ( parseTags, renderTags, parseTagsT, renderTagsT, ensureUtf8Xml+ , escapeHtml, escapeHtmlT, unescapeHtml, unescapeHtmlT+ ) where import Text.HTML.TagSoup (Tag(..))@@ -233,6 +235,13 @@ -- entities length are also not longer than 8 -- so we are looking for ';' after '&' no more than 9 symbols +-- | Alternative to 'unescapeHtml' working with 'Text'+unescapeHtmlT :: T.Text -> T.Text+unescapeHtmlT s+ | Nothing <- T.find (== '&') s = s+ | otherwise = bst $ unescapeHtml $ T.encodeUtf8 s++-- | Convert escaped HTML to raw. unescapeHtml :: B.ByteString -> B.ByteString unescapeHtml s | not (B8.elem "&" s) = s@@ -299,11 +308,13 @@ textTag (TagWarning t) = TagWarning (bst t) textTag (TagPosition r c) = TagPosition r c +-- | Alternative to 'escapeHtml' working with 'Text' escapeHtmlT :: T.Text -> T.Text escapeHtmlT s | not $ T.any (\ c -> c=='&'||c=='<'||c=='>'||c=='\''||c=='"') s = s | otherwise = bst $ escapeHtml $ T.encodeUtf8 s +-- | Escape characters unsafe to HTML escapeHtml :: B.ByteString -> B.ByteString escapeHtml s | Nothing <- B8.find (\ c -> c=="&"||c=="<"||c==">"||c=="'"||c=="\"") s = s
fast-tagsoup.cabal view
@@ -1,6 +1,6 @@ cabal-version: >= 1.6 name: fast-tagsoup-version: 1.0.2+version: 1.0.3 copyright: Vladimir Shabanov 2011-2012 author: Vladimir Shabanov <vshabanoff@gmail.com> maintainer: Vladimir Shabanov <vshabanoff@gmail.com>