Text.Cassius

shakespeare-2.0.8: 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

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

# Type class

class ToCss a where

Methods

toCss :: a -> Builder

Instances

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

# Rendering

renderCss :: Css -> Text

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

# Parsing

cassius :: QuasiQuoter

cassiusFile :: FilePath -> Q Exp

cassiusFileDebug :: FilePath -> Q Exp

cassiusFileReload :: FilePath -> Q Exp

## Mixims

cassiusMixin :: QuasiQuoter

Create a mixin with Cassius syntax.

Since 2.0.3

data Mixin

Instances

Monoid Mixin |
Lift Mixin |

# ToCss instances

## Color

data Color

Constructors

Color Word8 Word8 Word8 |

Instances

Show Color |
ToCss Color |

colorRed :: Color

colorBlack :: Color

## Size

mkSize :: String -> ExpQ

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

data AbsoluteUnit

Absolute size units.

Constructors

Centimeter |
Inch |
Millimeter |
Pica |
Point |

Instances

Eq AbsoluteUnit |
Show AbsoluteUnit |

data AbsoluteSize

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 |
Fractional AbsoluteSize |
Num AbsoluteSize |
Ord AbsoluteSize |
Show AbsoluteSize |
ToCss AbsoluteSize |

absoluteSize :: AbsoluteUnit -> Rational -> AbsoluteSize

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

data EmSize

Constructors

EmSize Rational |

Instances

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

data ExSize

Constructors

ExSize Rational |

Instances

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

data PercentageSize

Not intended for direct use, see `mkSize`.

Constructors

PercentageSize |
Fields percentageSizeValue :: Rational Normalized value, 1 == 100%.

Instances

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

percentageSize :: Rational -> PercentageSize

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

data PixelSize

Constructors

PixelSize Rational |

Instances

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

# Internal

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

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