tagchup-0.4.1: alternative package for processing of tag soups

Safe HaskellSafe
LanguageHaskell98

Text.HTML.Tagchup.Tag

Synopsis

Documentation

data T name string Source #

An HTML element, a document is [T]. There is no requirement for Open and Close to match.

The type parameter string lets you choose between [Char] for interpreted HTML entity references and [HTMLChar.T] for uninterpreted HTML entities. You will most oftenly want plain Char, since HTMLChar.T is only necessary if you want to know, whether a non-ASCII character was encoded as HTML entity or as non-ASCII Unicode character.

Constructors

Open (Name name) [T name string]

An open tag with Ts in their original order.

Close (Name name)

A closing tag

Text string

A text node, guaranteed not to be the empty string

Comment String

A comment

Special (Name name) String

A tag like <!DOCTYPE ...>

Processing (Name name) (T name string)

A tag like <?xml ...>

Warning String

Mark a syntax error in the input file

Instances

Functor (T name) Source # 

Methods

fmap :: (a -> b) -> T name a -> T name b #

(<$) :: a -> T name b -> T name a #

Foldable (T name) Source # 

Methods

fold :: Monoid m => T name m -> m #

foldMap :: Monoid m => (a -> m) -> T name a -> m #

foldr :: (a -> b -> b) -> b -> T name a -> b #

foldr' :: (a -> b -> b) -> b -> T name a -> b #

foldl :: (b -> a -> b) -> b -> T name a -> b #

foldl' :: (b -> a -> b) -> b -> T name a -> b #

foldr1 :: (a -> a -> a) -> T name a -> a #

foldl1 :: (a -> a -> a) -> T name a -> a #

toList :: T name a -> [a] #

null :: T name a -> Bool #

length :: T name a -> Int #

elem :: Eq a => a -> T name a -> Bool #

maximum :: Ord a => T name a -> a #

minimum :: Ord a => T name a -> a #

sum :: Num a => T name a -> a #

product :: Num a => T name a -> a #

Traversable (T name) Source # 

Methods

traverse :: Applicative f => (a -> f b) -> T name a -> f (T name b) #

sequenceA :: Applicative f => T name (f a) -> f (T name a) #

mapM :: Monad m => (a -> m b) -> T name a -> m (T name b) #

sequence :: Monad m => T name (m a) -> m (T name a) #

(Eq string, Eq name) => Eq (T name string) Source # 

Methods

(==) :: T name string -> T name string -> Bool #

(/=) :: T name string -> T name string -> Bool #

(Ord string, Ord name) => Ord (T name string) Source # 

Methods

compare :: T name string -> T name string -> Ordering #

(<) :: T name string -> T name string -> Bool #

(<=) :: T name string -> T name string -> Bool #

(>) :: T name string -> T name string -> Bool #

(>=) :: T name string -> T name string -> Bool #

max :: T name string -> T name string -> T name string #

min :: T name string -> T name string -> T name string #

(Show string, Show name, Attribute name) => Show (T name string) Source # 

Methods

showsPrec :: Int -> T name string -> ShowS #

show :: T name string -> String #

showList :: [T name string] -> ShowS #

(Tag name, Attribute name, C string) => C (T name string) Source # 

Methods

run :: T name string -> ShowS #

newtype Name ident :: * -> * #

Constructors

Name ident 

Instances

Eq ident => Eq (Name ident) 

Methods

(==) :: Name ident -> Name ident -> Bool #

(/=) :: Name ident -> Name ident -> Bool #

Ord ident => Ord (Name ident) 

Methods

compare :: Name ident -> Name ident -> Ordering #

(<) :: Name ident -> Name ident -> Bool #

(<=) :: Name ident -> Name ident -> Bool #

(>) :: Name ident -> Name ident -> Bool #

(>=) :: Name ident -> Name ident -> Bool #

max :: Name ident -> Name ident -> Name ident #

min :: Name ident -> Name ident -> Name ident #

Show ident => Show (Name ident) 

Methods

showsPrec :: Int -> Name ident -> ShowS #

show :: Name ident -> String #

showList :: [Name ident] -> ShowS #

Tag ident => C (Name ident) 

Methods

fromString :: String -> Name ident #

toString :: Name ident -> String #

mapName :: (Name name0 -> Name name1) -> (Name name0 -> Name name1) -> T name0 string -> T name1 string Source #

open :: Name name -> [T name string] -> T name string Source #

isOpen :: T name string -> Bool Source #

Test if a T is a Open

maybeOpen :: T name string -> Maybe (Name name, [T name string]) Source #

close :: Name name -> T name string Source #

isClose :: T name string -> Bool Source #

Test if a T is a Close

maybeClose :: T name string -> Maybe (Name name) Source #

text :: string -> T name string Source #

isText :: T name string -> Bool Source #

Test if a T is a Text

maybeText :: T name string -> Maybe string Source #

Extract the string from within Text, otherwise Nothing

innerText :: Monoid string => [T name string] -> string Source #

Extract all text content from tags (similar to Verbatim found in HaXml)

comment :: String -> T name string Source #

isComment :: T name string -> Bool Source #

maybeComment :: T name string -> Maybe String Source #

special :: Name name -> String -> T name string Source #

isSpecial :: T name string -> Bool Source #

maybeSpecial :: T name string -> Maybe (Name name, String) Source #

cdata :: Tag name => String -> T name string Source #

isCData :: Tag name => T name string -> Bool Source #

maybeCData :: Tag name => T name string -> Maybe String Source #

processing :: Name name -> T name string -> T name string Source #

isProcessing :: T name string -> Bool Source #

maybeProcessing :: T name string -> Maybe (Name name, T name string) Source #

warning :: String -> T name string Source #

isWarning :: T name string -> Bool Source #

maybeWarning :: T name string -> Maybe String Source #

formatOpen :: (Tag name, Attribute name, C string) => Bool -> Name name -> [T name string] -> ShowS Source #

formatClose :: Tag name => Name name -> ShowS Source #

textFromCData :: (Tag name, C char) => T name [char] -> T name [char] Source #

Replace CDATA sections by plain text.

concatTexts :: Monoid string => [T name string] -> [T name string] Source #

Merge adjacent Text sections.

mapText :: Tag name => (String -> String) -> T name String -> T name String Source #

Modify content of a Text or a CDATA part.

mapTextA :: (Tag name, Applicative f) => (String -> f String) -> T name String -> f (T name String) Source #