Blame src/Text/HTML/TagSoup/Parser.hs
|
Packit |
247f4e |
|
|
Packit |
247f4e |
module Text.HTML.TagSoup.Parser(
|
|
Packit |
247f4e |
parseTags, parseTagsOptions,
|
|
Packit |
247f4e |
ParseOptions(..), parseOptions, parseOptionsFast, parseOptionsEntities
|
|
Packit |
247f4e |
) where
|
|
Packit |
247f4e |
|
|
Packit |
247f4e |
import Text.HTML.TagSoup.Type
|
|
Packit |
247f4e |
import Text.HTML.TagSoup.Options
|
|
Packit |
247f4e |
import qualified Text.HTML.TagSoup.Generated as Gen
|
|
Packit |
247f4e |
|
|
Packit |
247f4e |
|
|
Packit |
247f4e |
-- | Parse a string to a list of tags, using an HTML 5 compliant parser.
|
|
Packit |
247f4e |
--
|
|
Packit |
247f4e |
-- > parseTags "<hello>my&</world>" == [TagOpen "hello" [],TagText "my&",TagClose "world"]
|
|
Packit |
247f4e |
parseTags :: StringLike str => str -> [Tag str]
|
|
Packit |
247f4e |
parseTags = parseTagsOptions parseOptions
|
|
Packit |
247f4e |
|
|
Packit |
247f4e |
|
|
Packit |
247f4e |
-- | Parse a string to a list of tags, using settings supplied by the 'ParseOptions' parameter,
|
|
Packit |
247f4e |
-- eg. to output position information:
|
|
Packit |
247f4e |
--
|
|
Packit |
247f4e |
-- > parseTagsOptions parseOptions{optTagPosition = True} "<hello>my&</world>" ==
|
|
Packit |
247f4e |
-- > [TagPosition 1 1,TagOpen "hello" [],TagPosition 1 8,TagText "my&",TagPosition 1 15,TagClose "world"]
|
|
Packit |
247f4e |
parseTagsOptions :: StringLike str => ParseOptions str -> str -> [Tag str]
|
|
Packit |
247f4e |
parseTagsOptions = Gen.parseTagsOptions
|