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

Safe Haskell | None
Language | Haskell2010

Text.Cassius.Ordered

Contents

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

Description

This module is the twin brother of module Text.Cassius. The difference is that these parsers preserv the given order of attributes and mixin blocks.

    let bams = [cassiusMixin|
                  bam1:bam2
                  ^{bins}
                  bam3:bam4
               |] :: Mixin
        bins = [cassiusMixin|
                  bin1:bin2
               |] :: Mixin
     in renderCss ([Text.Ordered.lucius|foo{bar1:bar2;^{bams};bar3:bar4;}|] undefined)
    "foo{bar1:bar2;bam1:bam2;bin1:bin2;bam3:bam4;bar3:bar4}"

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

Instances details

ToCss AbsoluteSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: AbsoluteSize -> Builder Source #
ToCss Color Source # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: Color -> Builder Source #
ToCss EmSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: EmSize -> Builder Source #
ToCss ExSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: ExSize -> Builder Source #
ToCss PercentageSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: PercentageSize -> Builder Source #
ToCss PixelSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: PixelSize -> Builder Source #
ToCss Text Source # |
Instance details Defined in Text.Internal.Css Methods toCss :: Text -> Builder Source #
ToCss Text Source # |
Instance details Defined in Text.Internal.Css Methods toCss :: Text -> Builder Source #
ToCss [Char] Source # |
Instance details Defined in Text.Internal.Css Methods toCss :: [Char] -> Builder Source #

# Rendering

renderCss :: Css -> Text Source #

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

# Parsing

cassius :: QuasiQuoter Source #

Since: 2.0.30

cassiusFile :: FilePath -> Q Exp Source #

Since: 2.0.30

cassiusFileDebug :: FilePath -> Q Exp Source #

Since: 2.0.30

cassiusFileReload :: FilePath -> Q Exp Source #

Since: 2.0.30

## Mixims

cassiusMixin :: QuasiQuoter Source #

Create a mixin with Cassius syntax.

| @since 2.0.30

data Mixin Source #

#### Instances

Instances details

Monoid Mixin Source # |
Instance details Defined in Text.Internal.Css Methods mempty :: Mixin Source # mappend :: Mixin -> Mixin -> Mixin Source # mconcat :: [Mixin] -> Mixin Source #
Semigroup Mixin Source # |
Instance details Defined in Text.Internal.Css Methods (<>) :: Mixin -> Mixin -> Mixin Source # sconcat :: NonEmpty Mixin -> Mixin Source # stimes :: Integral b => b -> Mixin -> Mixin Source #
Lift Mixin Source # |
Instance details Defined in Text.Internal.Css Methods lift :: Quote m => Mixin -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Mixin -> Code m Mixin Source #

# ToCss instances

## Color

data Color Source #

Constructors

Color Word8 Word8 Word8 |

#### Instances

Instances details

Show Color Source # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> Color -> ShowS Source # show :: Color -> String Source # showList :: [Color] -> ShowS Source #
ToCss Color Source # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: Color -> Builder 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

Instances details

Show AbsoluteUnit Source # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> AbsoluteUnit -> ShowS Source # show :: AbsoluteUnit -> String Source # showList :: [AbsoluteUnit] -> ShowS Source #
Eq AbsoluteUnit Source # |
Instance details Defined in Text.Internal.CssCommon Methods (==) :: AbsoluteUnit -> AbsoluteUnit -> Bool Source # (/=) :: AbsoluteUnit -> AbsoluteUnit -> Bool 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

Instances details

Num AbsoluteSize Source # |

Instance details

Defined in Text.Internal.CssCommon

Methods

(+) :: AbsoluteSize -> AbsoluteSize -> AbsoluteSize Source #

(-) :: AbsoluteSize -> AbsoluteSize -> AbsoluteSize Source #

(*) :: AbsoluteSize -> AbsoluteSize -> AbsoluteSize Source #

negate :: AbsoluteSize -> AbsoluteSize Source #

abs :: AbsoluteSize -> AbsoluteSize Source #

signum :: AbsoluteSize -> AbsoluteSize Source #

fromInteger :: Integer -> AbsoluteSize Source #

Fractional AbsoluteSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods (/) :: AbsoluteSize -> AbsoluteSize -> AbsoluteSize Source # recip :: AbsoluteSize -> AbsoluteSize Source # fromRational :: Rational -> AbsoluteSize Source #
Show AbsoluteSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> AbsoluteSize -> ShowS Source # show :: AbsoluteSize -> String Source # showList :: [AbsoluteSize] -> ShowS Source #
Eq AbsoluteSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods (==) :: AbsoluteSize -> AbsoluteSize -> Bool Source # (/=) :: AbsoluteSize -> AbsoluteSize -> Bool Source #
Ord AbsoluteSize Source # |

Instance details

Defined in Text.Internal.CssCommon

Methods

compare :: AbsoluteSize -> AbsoluteSize -> Ordering Source #

(<) :: AbsoluteSize -> AbsoluteSize -> Bool Source #

(<=) :: AbsoluteSize -> AbsoluteSize -> Bool Source #

(>) :: AbsoluteSize -> AbsoluteSize -> Bool Source #

(>=) :: AbsoluteSize -> AbsoluteSize -> Bool Source #

max :: AbsoluteSize -> AbsoluteSize -> AbsoluteSize Source #

min :: AbsoluteSize -> AbsoluteSize -> AbsoluteSize Source #

ToCss AbsoluteSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: AbsoluteSize -> Builder Source #

absoluteSize :: AbsoluteUnit -> Rational -> AbsoluteSize Source #

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

data EmSize Source #

Constructors

EmSize Rational |

#### Instances

Instances details

Num EmSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods (+) :: EmSize -> EmSize -> EmSize Source # (-) :: EmSize -> EmSize -> EmSize Source # (*) :: EmSize -> EmSize -> EmSize Source # negate :: EmSize -> EmSize Source # abs :: EmSize -> EmSize Source # signum :: EmSize -> EmSize Source # fromInteger :: Integer -> EmSize Source #
Fractional EmSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods (/) :: EmSize -> EmSize -> EmSize Source # recip :: EmSize -> EmSize Source # fromRational :: Rational -> EmSize Source #
Show EmSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> EmSize -> ShowS Source # show :: EmSize -> String Source # showList :: [EmSize] -> ShowS Source #
Eq EmSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods (==) :: EmSize -> EmSize -> Bool Source # (/=) :: EmSize -> EmSize -> Bool Source #
Ord EmSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods compare :: EmSize -> EmSize -> Ordering Source # (<) :: EmSize -> EmSize -> Bool Source # (<=) :: EmSize -> EmSize -> Bool Source # (>) :: EmSize -> EmSize -> Bool Source # (>=) :: EmSize -> EmSize -> Bool Source # max :: EmSize -> EmSize -> EmSize Source # min :: EmSize -> EmSize -> EmSize Source #
ToCss EmSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: EmSize -> Builder Source #

data ExSize Source #

Constructors

ExSize Rational |

#### Instances

Instances details

Num ExSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods (+) :: ExSize -> ExSize -> ExSize Source # (-) :: ExSize -> ExSize -> ExSize Source # (*) :: ExSize -> ExSize -> ExSize Source # negate :: ExSize -> ExSize Source # abs :: ExSize -> ExSize Source # signum :: ExSize -> ExSize Source # fromInteger :: Integer -> ExSize Source #
Fractional ExSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods (/) :: ExSize -> ExSize -> ExSize Source # recip :: ExSize -> ExSize Source # fromRational :: Rational -> ExSize Source #
Show ExSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> ExSize -> ShowS Source # show :: ExSize -> String Source # showList :: [ExSize] -> ShowS Source #
Eq ExSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods (==) :: ExSize -> ExSize -> Bool Source # (/=) :: ExSize -> ExSize -> Bool Source #
Ord ExSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods compare :: ExSize -> ExSize -> Ordering Source # (<) :: ExSize -> ExSize -> Bool Source # (<=) :: ExSize -> ExSize -> Bool Source # (>) :: ExSize -> ExSize -> Bool Source # (>=) :: ExSize -> ExSize -> Bool Source # max :: ExSize -> ExSize -> ExSize Source # min :: ExSize -> ExSize -> ExSize Source #
ToCss ExSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: ExSize -> Builder Source #

data PercentageSize Source #

Not intended for direct use, see `mkSize`.

Constructors

PercentageSize |

Fields

- percentageSizeValue :: Rational

  Normalized value, 1 == 100%.

#### Instances

Instances details

Num PercentageSize Source # |

Instance details

Defined in Text.Internal.CssCommon

Methods

(+) :: PercentageSize -> PercentageSize -> PercentageSize Source #

(-) :: PercentageSize -> PercentageSize -> PercentageSize Source #

(*) :: PercentageSize -> PercentageSize -> PercentageSize Source #

negate :: PercentageSize -> PercentageSize Source #

abs :: PercentageSize -> PercentageSize Source #

signum :: PercentageSize -> PercentageSize Source #

fromInteger :: Integer -> PercentageSize Source #

Fractional PercentageSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods (/) :: PercentageSize -> PercentageSize -> PercentageSize Source # recip :: PercentageSize -> PercentageSize Source # fromRational :: Rational -> PercentageSize Source #
Show PercentageSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> PercentageSize -> ShowS Source # show :: PercentageSize -> String Source # showList :: [PercentageSize] -> ShowS Source #
Eq PercentageSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods (==) :: PercentageSize -> PercentageSize -> Bool Source # (/=) :: PercentageSize -> PercentageSize -> Bool Source #
Ord PercentageSize Source # |

Instance details

Defined in Text.Internal.CssCommon

Methods

compare :: PercentageSize -> PercentageSize -> Ordering Source #

(<) :: PercentageSize -> PercentageSize -> Bool Source #

(<=) :: PercentageSize -> PercentageSize -> Bool Source #

(>) :: PercentageSize -> PercentageSize -> Bool Source #

(>=) :: PercentageSize -> PercentageSize -> Bool Source #

max :: PercentageSize -> PercentageSize -> PercentageSize Source #

min :: PercentageSize -> PercentageSize -> PercentageSize Source #

ToCss PercentageSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: PercentageSize -> Builder Source #

percentageSize :: Rational -> PercentageSize Source #

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

data PixelSize Source #

Constructors

PixelSize Rational |

#### Instances

Instances details

Num PixelSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods (+) :: PixelSize -> PixelSize -> PixelSize Source # (-) :: PixelSize -> PixelSize -> PixelSize Source # (*) :: PixelSize -> PixelSize -> PixelSize Source # negate :: PixelSize -> PixelSize Source # abs :: PixelSize -> PixelSize Source # signum :: PixelSize -> PixelSize Source # fromInteger :: Integer -> PixelSize Source #
Fractional PixelSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods (/) :: PixelSize -> PixelSize -> PixelSize Source # recip :: PixelSize -> PixelSize Source # fromRational :: Rational -> PixelSize Source #
Show PixelSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods showsPrec :: Int -> PixelSize -> ShowS Source # show :: PixelSize -> String Source # showList :: [PixelSize] -> ShowS Source #
Eq PixelSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods (==) :: PixelSize -> PixelSize -> Bool Source # (/=) :: PixelSize -> PixelSize -> Bool Source #
Ord PixelSize Source # |

Instance details

Defined in Text.Internal.CssCommon

Methods

compare :: PixelSize -> PixelSize -> Ordering Source #

(<) :: PixelSize -> PixelSize -> Bool Source #

(<=) :: PixelSize -> PixelSize -> Bool Source #

(>) :: PixelSize -> PixelSize -> Bool Source #

(>=) :: PixelSize -> PixelSize -> Bool Source #

max :: PixelSize -> PixelSize -> PixelSize Source #

min :: PixelSize -> PixelSize -> PixelSize Source #

ToCss PixelSize Source # |
Instance details Defined in Text.Internal.CssCommon Methods toCss :: PixelSize -> Builder Source #

# Internal

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

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