hxt-tagsoup 9.1.3 → 9.1.3.1
raw patch · 4 files changed
+56/−65 lines, 4 filesdep ~tagsoup
Dependency ranges changed: tagsoup
Files
- examples/hparser/HXmlParser.hs +1/−1
- hxt-tagsoup.cabal +6/−6
- src/Text/XML/HXT/Parser/TagSoup.hs +42/−52
- src/Text/XML/HXT/TagSoup.hs +7/−6
examples/hparser/HXmlParser.hs view
@@ -54,7 +54,7 @@ -- ------------------------------------------------------------ exitProg :: Bool -> IO a-exitProg True = exitWith (ExitFailure (-1))+exitProg True = exitWith (ExitFailure 1) exitProg False = exitWith ExitSuccess -- ------------------------------------------------------------
hxt-tagsoup.cabal view
@@ -1,15 +1,15 @@ -- arch-tag: Haskell XML Toolbox main description file Name: hxt-tagsoup-Version: 9.1.3+Version: 9.1.3.1 Synopsis: TagSoup parser for HXT Description: The Tagsoup interface for the HXT lazy HTML parser.-License: OtherLicense+License: MIT License-file: LICENSE Author: Uwe Schmidt Maintainer: Uwe Schmidt <uwe@fh-wedel.de> Stability: Stable Category: XML-Homepage: http://www.fh-wedel.de/~si/HXmlToolbox/index.html+Homepage: https://github.com/UweSchmidt/hxt Copyright: Copyright (c) 2014 Uwe Schmidt Build-type: Simple Cabal-version: >=1.6@@ -28,12 +28,12 @@ hs-source-dirs: src ghc-options: -Wall- ghc-prof-options: -auto-all -caf-all+ ghc-prof-options: -caf-all - extensions: MultiParamTypeClasses DeriveDataTypeable FunctionalDependencies FlexibleInstances+ extensions: MultiParamTypeClasses DeriveDataTypeable FunctionalDependencies FlexibleInstances CPP build-depends: base >= 4 && < 5,- tagsoup >= 0.13 && < 0.14,+ tagsoup >= 0.13 && < 0.15, hxt-charproperties >= 9 && < 10, hxt-unicode >= 9 && < 10, hxt >= 9.1 && < 10
src/Text/XML/HXT/Parser/TagSoup.hs view
@@ -1,8 +1,10 @@+{-# LANGUAGE CPP #-}+ -- ------------------------------------------------------------ {- | Module : Text.XML.HXT.Parser.TagSoup- Copyright : Copyright (C) 2005-2014 Uwe Schmidt+ Copyright : Copyright (C) 2005-2015 Uwe Schmidt License : MIT Maintainer : Uwe Schmidt (uwe@fh-wedel.de)@@ -23,46 +25,34 @@ -- ------------------------------------------------------------ -import Control.Applicative ( Applicative(..) )-import Control.Monad ( liftM, ap )+#if MIN_VERSION_base(4,8,0)+#else+import Control.Applicative (Applicative (..))+#endif -import Data.Char ( toLower- )-import Data.Char.Properties.XMLCharProps( isXmlSpaceChar- )-import Data.Maybe+import Control.Monad (ap, liftM) -import Text.HTML.TagSoup-import Text.HTML.TagSoup.Entity ( lookupNumericEntity- )-import Text.XML.HXT.Parser.HtmlParsec ( isEmptyHtmlTag- , isInnerHtmlTagOf- , closesHtmlTag- )-import Text.XML.HXT.Parser.XhtmlEntities-import Text.XML.HXT.DOM.Interface ( XmlTrees- , QName- , NsEnv- , toNsEnv- , newXName- , newQName- , nullXName- , mkName- , isWellformedQualifiedName- , c_warn- , a_xml- , a_xmlns- , xmlNamespace- , xmlnsNamespace- )-import Text.XML.HXT.DOM.XmlNode ( isElem- , mkError'- , mkCmt'- , mkText'- , mkElement- , mkAttr'- )+import Data.Char (toLower)+import Data.Char.Properties.XMLCharProps (isXmlSpaceChar)+import Data.Maybe +import Text.HTML.TagSoup+import Text.HTML.TagSoup.Entity (lookupNumericEntity)+import Text.XML.HXT.DOM.Interface (NsEnv, QName, XmlTrees,+ a_xml, a_xmlns, c_warn,+ isWellformedQualifiedName,+ mkName, newQName, newXName,+ nullXName, toNsEnv,+ xmlNamespace,+ xmlnsNamespace)+import Text.XML.HXT.DOM.XmlNode (isElem, mkAttr', mkCmt',+ mkElement, mkError',+ mkText')+import Text.XML.HXT.Parser.HtmlParsec (closesHtmlTag,+ isEmptyHtmlTag,+ isInnerHtmlTagOf)+import Text.XML.HXT.Parser.XhtmlEntities+ -- ---------------------------------------- -- The name table contains the id map. All element and attribute names are stored@@ -255,36 +245,36 @@ lookupEntity withWarnings _asHtml (e0@('#':e), withSemicolon) = case lookupNumericEntity e of Just c -> (TagText c)- : missingSemi+ : missingSemi Nothing -> ( TagText $ "&" ++ e0 ++ [';' | withSemicolon])- : if withWarnings+ : if withWarnings then (TagWarning $ "illegal char reference: &" ++ e ++ ";")- : missingSemi- else []+ : missingSemi+ else [] where missingSemi- | withWarnings- &&- not withSemicolon = [TagWarning $ "missing \";\" at end of char reference: &" ++ e]+ | withWarnings+ &&+ not withSemicolon = [TagWarning $ "missing \";\" at end of char reference: &" ++ e] | otherwise = [] lookupEntity withWarnings asHtml (e, withSemicolon) = case (lookup e entities) of Just x -> (TagText [toEnum x])- : missingSemi+ : missingSemi Nothing -> (TagText $ "&" ++ e ++ [';' | withSemicolon])- : if withWarnings+ : if withWarnings then (TagWarning $ "Unknown entity reference: &" ++ e ++ ";")- : missingSemi- else []+ : missingSemi+ else [] where entities | asHtml = xhtmlEntities | otherwise = xhtmlEntities -- xmlEntities (TODO: xhtml is xml and html) missingSemi- | withWarnings- &&- not withSemicolon = [TagWarning $ "missing \";\" at end of entity reference: &" ++ e]+ | withWarnings+ &&+ not withSemicolon = [TagWarning $ "missing \";\" at end of entity reference: &" ++ e] | otherwise = [] lookupEntityAttr :: Bool -> Bool -> (String, Bool) -> (String, Tags)
src/Text/XML/HXT/TagSoup.hs view
@@ -21,19 +21,20 @@ ) where -import System.Console.GetOpt+import System.Console.GetOpt -import Text.XML.HXT.Arrow.TagSoupInterface-import Text.XML.HXT.Arrow.XmlState+import Text.XML.HXT.Arrow.TagSoupInterface+import Text.XML.HXT.Arrow.XmlState -- ------------------------------------------------------------ -a_tagsoup :: String+a_tagsoup :: String a_tagsoup = "tagsoup" -tagSoupOptions :: [OptDescr SysConfig]+tagSoupOptions :: [OptDescr SysConfig] tagSoupOptions- = [ Option "T" [a_tagsoup] (NoArg withTagSoup) "lazy tagsoup parser, for HTML and XML, no DTD, no validation, no PIs, only XHTML entityrefs"+ = [ Option "T" [a_tagsoup] (NoArg withTagSoup)+ "lazy tagsoup parser, for HTML and XML, no DTD, no validation, no PIs, only XHTML entityrefs" ] -- ------------------------------------------------------------