Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 #
Instances
Show ParseTokenForestError Source # | |
Defined in Text.HTML.Tree showsPrec :: Int -> ParseTokenForestError -> ShowS # show :: ParseTokenForestError -> String # showList :: [ParseTokenForestError] -> ShowS # | |
Eq ParseTokenForestError Source # | |
Defined in Text.HTML.Tree (==) :: ParseTokenForestError -> ParseTokenForestError -> Bool # (/=) :: ParseTokenForestError -> ParseTokenForestError -> Bool # |
PStack | |
|
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
.