| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Text.HTML.Tree
Synopsis
- tokensToForest :: [Token] -> Either ParseTokenForestError (Forest Token)
- data ParseTokenForestError = ParseTokenForestErrorBracketMismatch PStack (Maybe Token)
- data PStack = PStack {
- _pstackToplevelSiblings :: Forest Token
- _pstackParents :: [(Token, Forest Token)]
- nonClosing :: [Text]
- tokensFromForest :: Forest Token -> [Token]
- tokensFromTree :: Tree Token -> [Token]
Constructing forests
tokensToForest :: [Token] -> Either ParseTokenForestError (Forest Token) Source #
construct a Forest from a Token list.
This code correctly handles void elements. Void elements are required to have a start tag and must not have an end tag. See nonClosing.
This code does not correctly handle optional tags. It assumes all optional start and end tags are present.
data ParseTokenForestError Source #
Constructors
| ParseTokenForestErrorBracketMismatch PStack (Maybe Token) |
Instances
| Show ParseTokenForestError Source # | |
Defined in Text.HTML.Tree Methods showsPrec :: Int -> ParseTokenForestError -> ShowS # show :: ParseTokenForestError -> String # showList :: [ParseTokenForestError] -> ShowS # | |
| Eq ParseTokenForestError Source # | |
Defined in Text.HTML.Tree Methods (==) :: ParseTokenForestError -> ParseTokenForestError -> Bool # (/=) :: ParseTokenForestError -> ParseTokenForestError -> Bool # | |
Constructors
| PStack | |
Fields
| |
nonClosing :: [Text] Source #
void elements which must not have an end tag
This list does not include the obsolete <command> and <keygen> elements.
nonClosing = ["br", "hr", "img", "meta", "area", "base", "col", "embed", "input", "link", "param", "source", "track", "wbr"]
Deconstructing forests
tokensFromForest :: Forest Token -> [Token] Source #
convert a Forest of Token into a list of Token.
This code correctly handles void elements. Void elements are required to have a start tag and must not have an end tag. See nonClosing.
tokensFromTree :: Tree Token -> [Token] Source #
convert a Tree of Token into a list of Token.
This code correctly handles void elements. Void elements are required to have a start tag and must not have an end tag. See nonClosing.