HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleblaze-svg-0.3.7Haskell2010

Text.Blaze.Svg11

This module exports SVG combinators used to create documents.

Synopsis
  • Packageblaze-svg-0.3.7
  • Exports116
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceSvg11.hs
value(!?) :: Attributable h => h -> (Bool, Attribute) -> h

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"
valuecontents :: MarkupM a -> MarkupM a

Take only the text content of an HTML tree.

contents $ do
    p ! $ "Hello "
    p ! $ "Word!"

Result:

Hello World!
valuecustomAttribute
  1. :: Tag

    Name of the attribute

  2. -> AttributeValue

    Value for the attribute

  3. -> Attribute

    Resulting 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"
valuedataAttribute
  1. :: Tag

    Name of the attribute.

  2. -> AttributeValue

    Value for the attribute.

  3. -> Attribute

    Resulting 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."
valuetext
  1. :: Text

    Text to render.

  2. -> Markup

    Resulting HTML fragment.

Render text. Functions like these can be used to supply content in HTML.

classclass ToMarkup a where

Class allowing us to use a single function for Markup values

Methods

Instances19ToMarkup, …
classclass ToValue a where

Class allowing us to use a single function for attribute values

Methods

Instances17ToValue, …
method(!) :: h -> Attribute -> h

Apply 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>
newtypenewtype Tag

Type for an HTML tag. This can be seen as an internal string type used by BlazeMarkup.

Instances1IsString
  • IsString TagDefined in blaze-markup-0.8.3.0 · Text.Blaze.Internal
valuedocType
  1. :: Svg

    The document type SVG.

Combinator for the document type. This should be placed at the top of every SVG page.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
    "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
valuedocTypeSvg
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <svg> element. This combinator will also insert the correct doctype.

valuea
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <a> element.

valuecircle
  1. :: Svg

    Resulting SVG.

Combinator for the <circle /> element.

valuecursor
  1. :: Svg

    Resulting SVG.

Combinator for the <cursor /> element.

valuedefs
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <defs> element.

valuedesc
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <desc> element.

valuefetile
  1. :: Svg

    Resulting SVG.

Combinator for the <feTile /> element.

valuefont
  1. :: Svg

    Resulting SVG.

Combinator for the <font /> element.

valueg
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <g> element.

valueglyph
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <glyph> element.

valuehkern
  1. :: Svg

    Resulting SVG.

Combinator for the <hkern /> element.

valueimage
  1. :: Svg

    Resulting SVG.

Combinator for the <image /> element.

valueline
  1. :: Svg

    Resulting SVG.

Combinator for the <line /> element.

valuemarker
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <marker> element.

valuemask
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <mask> element.

valuempath
  1. :: Svg

    Resulting SVG.

Combinator for the <mpath /> element.

valuepath
  1. :: Svg

    Resulting SVG.

Combinator for the <path /> element.

valuerect
  1. :: Svg

    Resulting SVG.

Combinator for the <rect /> element.

valuescript
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <script> element.

valueset
  1. :: Svg

    Resulting SVG.

Combinator for the <set /> element.

valuestop
  1. :: Svg

    Resulting SVG.

Combinator for the <stop /> element.

valuestyle
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <style> element.

valuesvg
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <svg> element.

valueswitch
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <switch> element.

valuesymbol
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <symbol> element.

valuetext_
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <text> element.

valuetitle
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <title> element.

valuetref
  1. :: Svg

    Resulting SVG.

Combinator for the <tref /> element.

valuetspan
  1. :: Svg

    Inner SVG.

  2. -> Svg

    Resulting SVG.

Combinator for the <tspan> element.

valueuse
  1. :: Svg

    Resulting SVG.

Combinator for the <use /> element.

valueview
  1. :: Svg

    Resulting SVG.

Combinator for the <view /> element.

valuevkern
  1. :: Svg

    Resulting SVG.

Combinator for the <vkern /> element.