parse +tagsoup
These options control how parseTags works. The ParseOptions type is usually generated by one of parseOptions, parseOptionsFast or parseOptionsEntities, then selected fields may be overriden.
The options optTagPosition and optTagWarning specify whether to generate TagPosition or TagWarning elements respectively. Usually these options should be set to False to simplify future stages, unless you rely on position information or want to give malformed HTML messages to the end user.
The options optEntityData and optEntityAttrib control how entities, for example are handled. Both take a string, and a boolean, ended with a semi-colon ;. Inside normal text optEntityData will be called, and the results will be inserted in the tag stream. Inside a tag attribute optEntityAttrib will be called, and the first component of the result will be used in the attribute, and the second component will be appended after the TagOpen value (usually the second component is []). As an example, to not decode any entities, pass:
> parseOptions
> {optEntityData=\(str,b) -> [TagText $ "&" ++ str ++ [';' | b]]
> ,optEntityAttrib\(str,b) -> ("&" ++ str ++ [';' | b], [])
A ParseOptions structure using a custom function to lookup attributes. Any attribute that is not found will be left intact, and a TagWarning given (if optTagWarning is set).
If you do not want to resolve any entities, simpliy pass const Nothing for the lookup function.
A ParseOptions structure optimised for speed, following the fast options.
Parse a string to a list of tags, using an HTML 5 compliant parser.
> parseTags "<hello>my&</world>" == [TagOpen "hello" [],TagText "my&",TagClose "world"]
Parse a string to a list of tags, using settings supplied by the ParseOptions parameter, eg. to output position information:
> parseTagsOptions parseOptions{optTagPosition = True} "<hello>my&</world>" ==
> [TagPosition 1 1,TagOpen "hello" [],TagPosition 1 8,TagText "my&",TagPosition 1 15,TagClose "world"]