xml-basic 0.1.1.3 → 0.1.2
raw patch · 2 files changed
+26/−9 lines, 2 filesdep ~data-accessordep ~utility-ht
Dependency ranges changed: data-accessor, utility-ht
Files
- src/Text/HTML/Basic/Tag.hs +21/−3
- xml-basic.cabal +5/−6
src/Text/HTML/Basic/Tag.hs view
@@ -9,7 +9,8 @@ Tag.doctype, Tag.doctypeName, Tag.doctypeString, Tag.cdata, Tag.cdataName, Tag.cdataString, isEmpty, isSloppy, isInnerOf, closes,- maybeMetaHTTPHeader, maybeMetaEncoding,+ maybeMetaHTTPHeader, maybeMetaEncoding, maybeMetaCharset,+ encodingFromContentType, ) where @@ -22,8 +23,8 @@ import qualified Data.Map as Map import qualified Data.Set as Set +import qualified Data.List.Reverse.StrictElement as ListRev import qualified Data.Char as Char-import Data.List.HT (takeWhileRev, ) import Data.Tuple.HT (mapFst, ) import Control.Monad (guard, liftM2, ) @@ -196,6 +197,16 @@ {- |+Extract charset from Content-Type declaration.++> encodingFromContentType "text/html; charset=UTF-8" == "utf-8"++The routine does not perform any syntax check.+-}+encodingFromContentType :: String -> String+encodingFromContentType = map Char.toLower . ListRev.takeWhile ('='/=)++{- | A simple routine that does not check for valid syntax of the Content-Type specification. @@ -207,4 +218,11 @@ maybeMetaEncoding name attrs = do (headerName, content) <- maybeMetaHTTPHeader name attrs guard (("content-type"==) . map Char.toLower $ headerName)- return (map Char.toLower . takeWhileRev ('='/=) $ content)+ return $ encodingFromContentType content++maybeMetaCharset ::+ (Name.Tag name, Name.Attribute name) =>+ Tag.Name name -> [Attr.T name string] -> Maybe string+maybeMetaCharset name attrs =+ do guard (Name.match "meta" name)+ Attr.lookupLit "charset" attrs
xml-basic.cabal view
@@ -1,10 +1,9 @@ Name: xml-basic-Version: 0.1.1.3+Version: 0.1.2 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de> Maintainer: Henning Thielemann <haskell@henning-thielemann.de>-Homepage: http://www.haskell.org/haskellwiki/XML-Basic Category: XML Synopsis: Basics for XML/HTML representation and processing Description:@@ -14,7 +13,7 @@ We also provide information about exceptional HTML tags, like self-closing tags. This package provides common functionality- that is both needed in list (tagsoup-ht) and tree (wraxml) representations of XML.+ that is both needed in list (tagchup) and tree (wraxml) representations of XML. Tested-With: GHC==6.8.2, GHC==6.10.4, JHC==0.7.3 Cabal-Version: >=1.6 Build-Type: Simple@@ -25,7 +24,7 @@ Source-Repository this type: darcs location: http://code.haskell.org/~thielema/xml-basic/- tag: 0.1.1.3+ tag: 0.1.2 Flag splitBase description: Choose the new smaller, split-up base package.@@ -33,8 +32,8 @@ Library Build-Depends: explicit-exception >=0.1.3 && <0.2,- data-accessor >=0.2 && <0.4,- utility-ht >=0.0.4 && <0.1+ data-accessor >=0.2 && <0.3,+ utility-ht >=0.0.13 && <0.1 If flag(splitBase) Build-Depends: containers >=0.1 && <0.6,