tagsoupSource codeContentsIndex
Text.HTML.TagSoup.Type
Contents
Data structures and parsing
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
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 Source
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)Source
An HTML attribute id="name" generates ("id","name")
type Row = IntSource
type Column = IntSource
Tag identification
isTagOpen :: Tag -> BoolSource
Test if a Tag is a TagOpen
isTagClose :: Tag -> BoolSource
Test if a Tag is a TagClose
isTagText :: Tag -> BoolSource
Test if a Tag is a TagText
isTagWarning :: Tag -> BoolSource
Test if a Tag is a TagWarning
isTagOpenName :: String -> Tag -> BoolSource
Returns True if the Tag is TagOpen and matches the given name
isTagCloseName :: String -> Tag -> BoolSource
Returns True if the Tag is TagClose and matches the given name
Extraction
fromTagText :: Tag -> StringSource
Extract the string from within TagText, crashes if not a TagText
fromAttrib :: String -> Tag -> StringSource
Extract an attribute, crashes if not a TagOpen. Returns "" if no attribute present.
maybeTagText :: Tag -> Maybe StringSource
Extract the string from within TagText, otherwise Nothing
maybeTagWarning :: Tag -> Maybe StringSource
Extract the string from within TagWarning, otherwise Nothing
innerText :: [Tag] -> StringSource
Extract all text content from tags (similar to Verbatim found in HaXml)
Produced by Haddock version 2.4.2