hxt-tagsoup 9.0.0 → 9.1.0
raw patch · 3 files changed
+49/−21 lines, 3 filesdep +hxt-unicodedep ~hxtdep ~tagsoupPVP ok
version bump matches the API change (PVP)
Dependencies added: hxt-unicode
Dependency ranges changed: hxt, tagsoup
API changes (from Hackage documentation)
+ Text.XML.HXT.TagSoup: withoutTagSoup :: SysConfig
Files
- hxt-tagsoup.cabal +5/−3
- src/Text/XML/HXT/Arrow/TagSoupInterface.hs +31/−5
- src/Text/XML/HXT/Parser/TagSoup.hs +13/−13
hxt-tagsoup.cabal view
@@ -1,6 +1,6 @@ -- arch-tag: Haskell XML Toolbox main description file Name: hxt-tagsoup-Version: 9.0.0+Version: 9.1.0 Synopsis: TagSoup parser for HXT Description: The Tagsoup interface for the HXT lazy HTML parser. License: OtherLicense@@ -28,11 +28,13 @@ hs-source-dirs: src ghc-options: -Wall+ ghc-prof-options: -auto-all -caf-all extensions: MultiParamTypeClasses DeriveDataTypeable FunctionalDependencies FlexibleInstances build-depends: base >= 4 && < 5, haskell98 >= 1 && < 2,- tagsoup >= 0.10 && < 0.11,+ tagsoup >= 0.10 && < 0.13, hxt-charproperties >= 9 && < 10,- hxt >= 9 && < 10+ hxt-unicode >= 9 && < 10,+ hxt >= 9.1 && < 10
src/Text/XML/HXT/Arrow/TagSoupInterface.hs view
@@ -2,7 +2,7 @@ {- | Module : Text.XML.HXT.Arrow.TagSoupInterface- Copyright : Copyright (C) 2005 Uwe Schmidt+ Copyright : Copyright (C) 2010 Uwe Schmidt License : MIT Maintainer : Uwe Schmidt (uwe@fh-wedel.de)@@ -22,6 +22,8 @@ import Control.Arrow.ArrowList import Control.Arrow.ArrowTree +import Data.String.Unicode ( normalizeNL )+ import Text.XML.HXT.DOM.Interface import Text.XML.HXT.Arrow.XmlArrow@@ -32,11 +34,35 @@ -- ------------------------------------------------------------ --- | enable TagSoup parsing+{- |+ The system config option to enable the tagsoup parser +Here is an example, how to use it:++> ...+> import Text.HXT.XML.Core+> import Text.HXT.XML.TagSoup+> ...+>+> readDocument [ withExpat ] "some-file.xml"+> ...++reads the given document and parses it with the lazy tagsoup parser.+There is no validation enabled.+-}++ withTagSoup :: SysConfig-withTagSoup = setS (theTagSoup .&&&. theTagSoupParser) (True, parseHtmlTagSoup)+withTagSoup = setS (theTagSoup .&&&.+ theExpat .&&&.+ theTagSoupParser+ ) (True, (False, parseHtmlTagSoup)) +-- | Turns off tagsoup parsing. The build in HXT parser will be used.++withoutTagSoup :: SysConfig+withoutTagSoup = setS theTagSoup False+ -- ------------------------------------------------------------ -- | The Tagsoup parser arrow@@ -59,8 +85,8 @@ replaceChildren ( ( getAttrValue a_source -- get source name &&&- xshow getChildren- ) -- get string to be parsed+ (xshow getChildren >>^ normalizeNL) -- get string to be parsed and normalize newline char+ ) >>> arr2L (TS.parseHtmlTagSoup withNamespaces' withWarnings' preserveCmt' removeWS' lowerCaseNames') )
src/Text/XML/HXT/Parser/TagSoup.hs view
@@ -42,8 +42,8 @@ , NsEnv , toNsEnv , newXName+ , newQName , nullXName- , mkQName' , mkName , isWellformedQualifiedName , c_warn@@ -53,11 +53,11 @@ , xmlnsNamespace ) import Text.XML.HXT.DOM.XmlNode ( isElem- , mkError- , mkCmt- , mkText+ , mkError'+ , mkCmt'+ , mkText' , mkElement- , mkAttr+ , mkAttr' ) -- ----------------------------------------@@ -142,7 +142,7 @@ -- primitive symbol parsers getTag :: Parser STag-getTag = P $ \ (t1:ts1) -> (t1, ts1)+getTag = P $ \ t -> (head t, tail t) getSym :: (STag -> a) -> Parser a getSym f = do@@ -208,8 +208,8 @@ where qn1 | isAttr && isSimpleName = s'- | isSimpleName = mkQName' nullXName (newXName s) (nsUri nullXName)- | isWellformedQualifiedName s = mkQName' px' lp' (nsUri px')+ | isSimpleName = newQName (newXName s) nullXName (nsUri nullXName)+ | isWellformedQualifiedName s = newQName lp' px' (nsUri px') | otherwise = s' qn0 = s' @@ -359,18 +359,18 @@ wrap = (:[]) warn- | withWarnings = wrap . mkError c_warn . show . (doc ++) . (" " ++)+ | withWarnings = wrap . mkError' c_warn . show . (doc ++) . (" " ++) | otherwise = const [] cmt- | withComment = wrap . mkCmt+ | withComment = wrap . mkCmt' | otherwise = const [] txt | removeWhiteSpace = \ t -> if all isXmlSpaceChar t then []- else wrap . mkText $ t- | otherwise = wrap . mkText+ else wrap . mkText' $ t+ | otherwise = wrap . mkText' isEmptyElem | asHtml = isEmptyHtmlTag@@ -486,7 +486,7 @@ mkAttrs = mapM (uncurry mkA) mkA an av = do qan <- mkAttrQN nenv an- return (mkAttr qan (wrap . mkText $ av))+ return (mkAttr' qan (wrap . mkText' $ av)) closeAll :: ([String], NsEnv) -> Parser XmlTrees closeAll (ns',_) = return (concatMap wrn ns')