| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Text.Seonbi.Html.Wrapper
Synopsis
- isWrappedBy :: [HtmlEntity] -> HtmlTag -> Bool
- isWrappedBy' :: [HtmlEntity] -> HtmlTag -> Maybe HtmlRawAttrs -> Bool
- wrap :: HtmlTagStack -> HtmlTag -> HtmlRawAttrs -> [HtmlEntity] -> [HtmlEntity]
Documentation
isWrappedBy :: [HtmlEntity] -> HtmlTag -> Bool Source #
A shortcut to isWrappedBy' of wildcard attributes match.
isWrappedBy' :: [HtmlEntity] -> HtmlTag -> Maybe HtmlRawAttrs -> Bool Source #
True if the given [ is wrapped by a tag and attributes.
E.g.:HtmlEntity]
>>>:set -XOverloadedLists>>>:set -XOverloadedStrings>>>:{let entities = [ HtmlStartTag [] Em " id=foo" , HtmlText [Em] "Hello" , HtmlEndTag [] Em ] :: [HtmlEntity] :}
>>>isWrappedBy' entities Em $ Just " id=foo"True>>>isWrappedBy' entities Div $ Just " id=foo"False>>>isWrappedBy' entities Em $ Just " id=wrong"False
In order to match to any attributes (wildcard match), give Nothing to
the third argument:
>>>isWrappedBy' entities Em NothingTrue>>>isWrappedBy' entities Span NothingFalse
Or you can use isWrappedBy function which is a shortcut for that.
wrap :: HtmlTagStack -> HtmlTag -> HtmlRawAttrs -> [HtmlEntity] -> [HtmlEntity] Source #
Wraps given entities with an element.