tagsoup-0.7: Parsing and extracting information from (possibly malformed) HTML documentsContentsIndex
Text.HTML.TagSoup.Type
Contents
Data structures and parsing
Position manipulation
Tag identification
Extraction
Description
The central type in TagSoup
Synopsis
data Tag
= TagOpen String [Attribute]
| TagClose String
| TagText String
| TagComment String
| TagWarning String
| TagPosition !Row !Column
type Attribute = (String, String)
type Row = Int
type Column = Int
data Position
tagPosition :: Position -> Tag
positionChar :: Position -> Char -> Position
positionString :: Position -> String -> Position
isTagOpen :: Tag -> Bool
isTagClose :: Tag -> Bool
isTagText :: Tag -> Bool
isTagWarning :: Tag -> Bool
isTagOpenName :: String -> Tag -> Bool
isTagCloseName :: String -> Tag -> Bool
fromTagText :: Tag -> String
fromAttrib :: String -> Tag -> String
maybeTagText :: Tag -> Maybe String
maybeTagWarning :: Tag -> Maybe String
innerText :: [Tag] -> String
Data structures and parsing
data Tag
An HTML element, a document is [Tag]. There is no requirement for TagOpen and TagClose to match
Constructors
TagOpen String [Attribute]An open tag with Attributes in their original order.
TagClose StringA closing tag
TagText StringA text node, guaranteed not to be the empty string
TagComment StringA comment
TagWarning StringMeta: Mark a syntax error in the input file
TagPosition !Row !ColumnMeta: The position of a parsed element
show/hide Instances
type Attribute = (String, String)
An HTML attribute id="name" generates ("id","name")
type Row = Int
type Column = Int
Position manipulation
data Position
show/hide Instances
tagPosition :: Position -> Tag
positionChar :: Position -> Char -> Position
positionString :: Position -> String -> Position
Tag identification
isTagOpen :: Tag -> Bool
Test if a Tag is a TagOpen
isTagClose :: Tag -> Bool
Test if a Tag is a TagClose
isTagText :: Tag -> Bool
Test if a Tag is a TagText
isTagWarning :: Tag -> Bool
Test if a Tag is a TagWarning
isTagOpenName :: String -> Tag -> Bool
Returns True if the Tag is TagOpen and matches the given name
isTagCloseName :: String -> Tag -> Bool
Returns True if the Tag is TagClose and matches the given name
Extraction
fromTagText :: Tag -> String
Extract the string from within TagText, crashes if not a TagText
fromAttrib :: String -> Tag -> String
Extract an attribute, crashes if not a TagOpen. Returns "" if no attribute present.
maybeTagText :: Tag -> Maybe String
Extract the string from within TagText, otherwise Nothing
maybeTagWarning :: Tag -> Maybe String
Extract the string from within TagWarning, otherwise Nothing
innerText :: [Tag] -> String
Extract all text content from tags (similar to Verbatim found in HaXml)
Produced by Haddock version 0.8