shakespeare-2.0.7: A toolkit for making compile-time interpolated templates

Safe Haskell | None
Language | Haskell98

Text.Cassius

Contents

- Datatypes
- Type class
- Rendering
- Parsing
  - Mixims
- ToCss instances
  - Color
  - Size
- Internal

Synopsis

- data Css
- type CssUrl url = (url -> [(Text, Text)] -> Text) -> Css
- class ToCss a where
  - toCss :: a -> Builder
- renderCss :: Css -> Text
- renderCssUrl :: (url -> [(Text, Text)] -> Text) -> CssUrl url -> Text
- cassius :: QuasiQuoter
- cassiusFile :: FilePath -> Q Exp
- cassiusFileDebug :: FilePath -> Q Exp
- cassiusFileReload :: FilePath -> Q Exp
- cassiusMixin :: QuasiQuoter
- data Mixin
- data Color = Color Word8 Word8 Word8
- colorRed :: Color
- colorBlack :: Color
- mkSize :: String -> ExpQ
- data AbsoluteUnit
  - = Centimeter
  - | Inch
  - | Millimeter
  - | Pica
  - | Point
- data AbsoluteSize = AbsoluteSize {
  - absoluteSizeUnit :: AbsoluteUnit
  - absoluteSizeValue :: Rational
  }
- absoluteSize :: AbsoluteUnit -> Rational -> AbsoluteSize
- data EmSize = EmSize Rational
- data ExSize = ExSize Rational
- data PercentageSize = PercentageSize {
  - percentageSizeValue :: Rational
  }
- percentageSize :: Rational -> PercentageSize
- data PixelSize = PixelSize Rational
- cassiusUsedIdentifiers :: String -> [(Deref, VarType)]

# Datatypes

data Css Source

type CssUrl url = (url -> [(Text, Text)] -> Text) -> Css Source

# Type class

class ToCss a where Source

Methods

toCss :: a -> Builder Source

Instances

ToCss Text Source |
ToCss Text Source |
ToCss PercentageSize Source |
ToCss AbsoluteSize Source |
ToCss Color Source |
ToCss EmSize Source |
ToCss ExSize Source |
ToCss PixelSize Source |
ToCss [Char] Source |

# Rendering

renderCss :: Css -> Text Source

renderCssUrl :: (url -> [(Text, Text)] -> Text) -> CssUrl url -> Text Source

# Parsing

cassius :: QuasiQuoter Source

cassiusFile :: FilePath -> Q Exp Source

cassiusFileDebug :: FilePath -> Q Exp Source

cassiusFileReload :: FilePath -> Q Exp Source

## Mixims

cassiusMixin :: QuasiQuoter Source

Create a mixin with Cassius syntax.

Since 2.0.3

data Mixin Source

Instances

Monoid Mixin Source |
Lift Mixin Source |

# ToCss instances

## Color

data Color Source

Constructors

Color Word8 Word8 Word8 |

Instances

Show Color Source |
ToCss Color Source |

colorRed :: Color Source

colorBlack :: Color Source

## Size

mkSize :: String -> ExpQ Source

Create a CSS size, e.g. $(mkSize "100px").

data AbsoluteUnit Source

Absolute size units.

Constructors

Centimeter |
Inch |
Millimeter |
Pica |
Point |

Instances

Eq AbsoluteUnit Source |
Show AbsoluteUnit Source |

data AbsoluteSize Source

Not intended for direct use, see `mkSize`.

Constructors

AbsoluteSize |

Fields

absoluteSizeUnit :: AbsoluteUnit

  Units used for text formatting.

absoluteSizeValue :: Rational

  Normalized value in centimeters.

Instances

Eq AbsoluteSize Source |
Fractional AbsoluteSize Source |
Num AbsoluteSize Source |
Ord AbsoluteSize Source |
Show AbsoluteSize Source |
ToCss AbsoluteSize Source |

absoluteSize :: AbsoluteUnit -> Rational -> AbsoluteSize Source

Constructs `AbsoluteSize`. Not intended for direct use, see `mkSize`.

data EmSize Source

Constructors

EmSize Rational |

Instances

Eq EmSize Source |
Fractional EmSize Source |
Num EmSize Source |
Ord EmSize Source |
Show EmSize Source |
ToCss EmSize Source |

data ExSize Source

Constructors

ExSize Rational |

Instances

Eq ExSize Source |
Fractional ExSize Source |
Num ExSize Source |
Ord ExSize Source |
Show ExSize Source |
ToCss ExSize Source |

data PercentageSize Source

Not intended for direct use, see `mkSize`.

Constructors

PercentageSize |

Fields

percentageSizeValue :: Rational

  Normalized value, 1 == 100%.

Instances

Eq PercentageSize Source |
Fractional PercentageSize Source |
Num PercentageSize Source |
Ord PercentageSize Source |
Show PercentageSize Source |
ToCss PercentageSize Source |

percentageSize :: Rational -> PercentageSize Source

Constructs `PercentageSize`. Not intended for direct use, see `mkSize`.

data PixelSize Source

Constructors

PixelSize Rational |

Instances

Eq PixelSize Source |
Fractional PixelSize Source |
Num PixelSize Source |
Ord PixelSize Source |
Show PixelSize Source |
ToCss PixelSize Source |

# Internal

cassiusUsedIdentifiers :: String -> [(Deref, VarType)] Source

Determine which identifiers are used by the given template, useful for creating systems like yesod devel.