tagsoup 0.13.7 → 0.13.8
raw patch · 3 files changed
+16/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Text.HTML.TagSoup.Tree: ParseOptions :: Bool -> Bool -> ((str, Bool) -> [Tag str]) -> ((str, Bool) -> (str, [Tag str])) -> Bool -> ParseOptions str
+ Text.HTML.TagSoup.Tree: RenderOptions :: (str -> str) -> (str -> Bool) -> (str -> Bool) -> RenderOptions str
+ Text.HTML.TagSoup.Tree: [optEntityAttrib] :: ParseOptions str -> (str, Bool) -> (str, [Tag str])
+ Text.HTML.TagSoup.Tree: [optEntityData] :: ParseOptions str -> (str, Bool) -> [Tag str]
+ Text.HTML.TagSoup.Tree: [optEscape] :: RenderOptions str -> str -> str
+ Text.HTML.TagSoup.Tree: [optMinimize] :: RenderOptions str -> str -> Bool
+ Text.HTML.TagSoup.Tree: [optRawTag] :: RenderOptions str -> str -> Bool
+ Text.HTML.TagSoup.Tree: [optTagPosition] :: ParseOptions str -> Bool
+ Text.HTML.TagSoup.Tree: [optTagTextMerge] :: ParseOptions str -> Bool
+ Text.HTML.TagSoup.Tree: [optTagWarning] :: ParseOptions str -> Bool
+ Text.HTML.TagSoup.Tree: data ParseOptions str
+ Text.HTML.TagSoup.Tree: data RenderOptions str
+ Text.HTML.TagSoup.Tree: parseTree :: StringLike str => str -> [TagTree str]
+ Text.HTML.TagSoup.Tree: parseTreeOptions :: StringLike str => ParseOptions str -> str -> [TagTree str]
+ Text.HTML.TagSoup.Tree: renderTree :: StringLike str => [TagTree str] -> str
+ Text.HTML.TagSoup.Tree: renderTreeOptions :: StringLike str => RenderOptions str -> [TagTree str] -> str
Files
- CHANGES.txt +2/−0
- Text/HTML/TagSoup/Tree.hs +13/−2
- tagsoup.cabal +1/−1
CHANGES.txt view
@@ -1,5 +1,7 @@ Changelog for TagSoup +0.13.8+ #30, add parse/render functions directly to the Tree module 0.13.7 #32, make sure upper case &#X works in lookupEntity 0.13.6
Text/HTML/TagSoup/Tree.hs view
@@ -7,10 +7,11 @@ module Text.HTML.TagSoup.Tree (- TagTree(..), tagTree,- flattenTree, transformTree, universeTree+ TagTree(..), tagTree, parseTree, parseTreeOptions, ParseOptions(..),+ flattenTree, renderTree, renderTreeOptions, RenderOptions(..), transformTree, universeTree ) where +import Text.HTML.TagSoup (parseTags, parseTagsOptions, renderTags, renderTagsOptions, ParseOptions(..), RenderOptions(..)) import Text.HTML.TagSoup.Type import Control.Arrow @@ -49,7 +50,12 @@ where (a,b) = f xs f [] = ([], []) +parseTree :: StringLike str => str -> [TagTree str]+parseTree = tagTree . parseTags +parseTreeOptions :: StringLike str => ParseOptions str -> str -> [TagTree str]+parseTreeOptions opts str = tagTree $ parseTagsOptions opts str+ flattenTree :: [TagTree str] -> [Tag str] flattenTree xs = concatMap f xs where@@ -57,6 +63,11 @@ TagOpen name atts : flattenTree inner ++ [TagClose name] f (TagLeaf x) = [x] +renderTree :: StringLike str => [TagTree str] -> str+renderTree = renderTags . flattenTree++renderTreeOptions :: StringLike str => RenderOptions str -> [TagTree str] -> str+renderTreeOptions opts trees = renderTagsOptions opts $ flattenTree trees -- | This operation is based on the Uniplate @universe@ function. Given a -- list of trees, it returns those trees, and all the children trees at
tagsoup.cabal view
@@ -1,6 +1,6 @@ cabal-version: >= 1.6 name: tagsoup-version: 0.13.7+version: 0.13.8 copyright: Neil Mitchell 2006-2016 author: Neil Mitchell <ndmitchell@gmail.com> maintainer: Neil Mitchell <ndmitchell@gmail.com>