Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 Nothing
True>>>
isWrappedBy' entities Span Nothing
False
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.