Shorthand for setting an attribute depending on a conditional.
Example:
p !? (isBig, A.class "big") $ "Hello"Gives the same result as:
(if isBig then p ! A.class "big" else p) "Hello":: a typeCtrl KGHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11
Moduleblaze-html-0.9.2.0Haskell98
Shorthand for setting an attribute depending on a conditional.
Example:
p !? (isBig, A.class "big") $ "Hello"Gives the same result as:
(if isBig then p ! A.class "big" else p) "Hello"Take only the text content of an HTML tree.
contents $ do
p ! $ "Hello "
p ! $ "Word!"Result:
Hello World!customAttribute :: TagName of the attribute
-> AttributeValueValue for the attribute
-> AttributeResulting HTML attribtue
Create a custom attribute. This is not specified in the HTML spec, but some JavaScript libraries rely on it.
An example:
<select dojoType="select">foo</select>Can be produced using:
select ! customAttribute "dojoType" "select" $ "foo"dataAttribute :: TagName of the attribute.
-> AttributeValueValue for the attribute.
-> AttributeResulting HTML attribute.
From HTML 5 onwards, the user is able to specify custom data attributes.
An example:
<p data-foo="bar">Hello.</p>We support this in BlazeMarkup using this function. The above fragment could be described using BlazeMarkup with:
p ! dataAttribute "foo" "bar" $ "Hello."Create a comment from a Text value.
The text should not contain "--".
This is not checked by the library.
A variant of preEscapedText for lazy Text
A variant of preEscapedTextValue for lazy Text
Create an HTML snippet from a String without escaping
Create an attribute value from a String without escaping.
Render text without escaping.
Render an attribute value from Text without escaping.
Create an HTML snippet from a String.
Create a comment from a String value.
The text should not contain "--".
This is not checked by the library.
Create an attribute value from a String.
Render text. Functions like these can be used to supply content in HTML.
Create a comment from a Text value.
The text should not contain "--".
This is not checked by the library.
Render an attribute value from Text.
Insert a ByteString. This is an unsafe operation:
The ByteString could have the wrong encoding.
The ByteString might contain illegal HTML characters (no escaping is done).
Create a comment from a ByteString value.
The text should not contain "--".
This is not checked by the library.
Create an attribute value from a ByteString. See unsafeByteString for reasons why this might not be a good idea.
Insert a lazy ByteString. See unsafeByteString for reasons why this is an unsafe operation.
Create a comment from a ByteString value.
The text should not contain "--".
This is not checked by the library.
unsafeLazyByteStringValue :: ByteStringByteString value
-> AttributeValueResulting attribute value
Create an attribute value from a lazy ByteString. See unsafeByteString for reasons why this might not be a good idea.
Class allowing us to use a single function for Markup values
toMarkup :: a -> MarkupConvert a value to Markup.
preEscapedToMarkup :: a -> MarkupConvert a value to Markup without escaping
ToMarkup MarkupDefined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup StringDefined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup IntegerDefined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup NaturalDefined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup Int32Defined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup Int64Defined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup BoolDefined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup CharDefined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup DoubleDefined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup FloatDefined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup IntDefined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup WordDefined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup Word32Defined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup Word64Defined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup TextDefined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup BuilderDefined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup TextDefined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup (NonEmpty Char)Defined in blaze-markup-0.8.3.0 · Text.BlazeToMarkup [Markup]Defined in blaze-markup-0.8.3.0 · Text.BlazeClass allowing us to use a single function for attribute values
toValue :: a -> AttributeValueConvert a value to an attribute value
preEscapedToValue :: a -> AttributeValueConvert a value to an attribute value without escaping
ToValue AttributeValueDefined in blaze-markup-0.8.3.0 · Text.BlazeToValue StringDefined in blaze-markup-0.8.3.0 · Text.BlazeToValue IntegerDefined in blaze-markup-0.8.3.0 · Text.BlazeToValue Int32Defined in blaze-markup-0.8.3.0 · Text.BlazeToValue Int64Defined in blaze-markup-0.8.3.0 · Text.BlazeToValue BoolDefined in blaze-markup-0.8.3.0 · Text.BlazeToValue CharDefined in blaze-markup-0.8.3.0 · Text.BlazeToValue DoubleDefined in blaze-markup-0.8.3.0 · Text.BlazeToValue FloatDefined in blaze-markup-0.8.3.0 · Text.BlazeToValue IntDefined in blaze-markup-0.8.3.0 · Text.BlazeToValue WordDefined in blaze-markup-0.8.3.0 · Text.BlazeToValue Word32Defined in blaze-markup-0.8.3.0 · Text.BlazeToValue Word64Defined in blaze-markup-0.8.3.0 · Text.BlazeToValue TextDefined in blaze-markup-0.8.3.0 · Text.BlazeToValue BuilderDefined in blaze-markup-0.8.3.0 · Text.BlazeToValue TextDefined in blaze-markup-0.8.3.0 · Text.BlazeToValue (NonEmpty Char)Defined in blaze-markup-0.8.3.0 · Text.BlazeApply an attribute to an element.
Example:
img ! src "foo.png"Result:
<img src="foo.png" />This can be used on nested elements as well.
Example:
p ! style "float: right" $ "Hello!"Result:
<p style="float: right">Hello!</p>Type for an attribute.
The type for the value part of an attribute.
IsString AttributeValueDefined in blaze-markup-0.8.3.0 · Text.Blaze.InternalSemigroup AttributeValueDefined in blaze-markup-0.8.3.0 · Text.Blaze.InternalMonoid AttributeValueDefined in blaze-markup-0.8.3.0 · Text.Blaze.InternalToValue AttributeValueDefined in blaze-markup-0.8.3.0 · Text.BlazeSimplification of the MarkupM datatype.
Type for an HTML tag. This can be seen as an internal string type used by BlazeMarkup.