tagchup- alternative package for processing of tag soups

Safe HaskellSafe-Inferred




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.


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


Functor (T name) 
Foldable (T name) 
Traversable (T name) 
(Eq name, Eq string) => Eq (T name string) 
(Ord name, Ord string) => Ord (T name string) 
(Show name, Show string, Attribute name) => Show (T name string) 
(Tag name, Attribute name, C string) => C (T name string) 

newtype Name ident


Name ident 


Eq ident => Eq (Name ident) 
Ord ident => Ord (Name ident) 
Show ident => Show (Name ident) 
Tag ident => C (Name ident) 

mapName :: (Name name0 -> Name name1) -> (Name name0 -> Name name1) -> T name0 string -> T name1 stringSource

open :: Name name -> [T name string] -> T name stringSource

isOpen :: T name string -> BoolSource

Test if a T is a Open

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

close :: Name name -> T name stringSource

isClose :: T name string -> BoolSource

Test if a T is a Close

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

text :: string -> T name stringSource

isText :: T name string -> BoolSource

Test if a T is a Text

maybeText :: T name string -> Maybe stringSource

Extract the string from within Text, otherwise Nothing

innerText :: Monoid string => [T name string] -> stringSource

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

comment :: String -> T name stringSource

isComment :: T name string -> BoolSource

maybeComment :: T name string -> Maybe StringSource

special :: Name name -> String -> T name stringSource

isSpecial :: T name string -> BoolSource

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

cdata :: Tag name => String -> T name stringSource

isCData :: Tag name => T name string -> BoolSource

maybeCData :: Tag name => T name string -> Maybe StringSource

processing :: Name name -> T name string -> T name stringSource

isProcessing :: T name string -> BoolSource

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

warning :: String -> T name stringSource

isWarning :: T name string -> BoolSource

maybeWarning :: T name string -> Maybe StringSource

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

formatClose :: Tag name => Name name -> ShowSSource

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 StringSource

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