Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data RenderState = RenderState {}
- data IgnoreBackground = IgnoreBackground
- ibStack :: Lens' RenderState [IgnoreBackground]
- fgStack :: Lens' RenderState [Color]
- bgStack :: Lens' RenderState [Color]
- type Stack a = Lens' RenderState [a]
- type Render = StateT RenderState (Writer Text)
- runRender :: Renderable a => a -> Text
- class Renderable a where
- write :: Text -> Render ()
- usingStackWithTag :: Renderable a => Stack a -> Text -> a -> AST -> Render ()
- pop :: Stack a -> Render (Maybe a)
- push :: Stack a -> a -> Render ()
- renew :: Renderable a => Stack a -> Text -> Render ()
Documentation
data RenderState Source #
Stacks are used to backtrack various dzen markup language tags.
Dzen itself does not perform backtracking, thus, for example, the letter "c"
in ^fg(red)a^fg(green)b^fg()c^fg()
will not be colorized,
but render
definition for AST
mitigates this flaw.
For example,
runRender $ ASTProp (FG $ Color "red") (ASTs (ASTs (ASTText "a") (ASTProp (FG $ Color "green") (ASTText "b"))) (ASTText "c"))
will be rendered as ^fg(red)a^fg(green)b^fg(red)c^fg()
(so that "c"
will be red).
data IgnoreBackground Source #
A flag that indicates that background should be ignored (analogous to ^ib()
dzen markup command).
Instances
Renderable IgnoreBackground Source # | |
Defined in DzenDhall.AST.Render render :: IgnoreBackground -> Render () Source # |
type Stack a = Lens' RenderState [a] Source #
runRender :: Renderable a => a -> Text Source #
class Renderable a where Source #
Instances
Renderable Event Source # | |
Renderable Button Source # | |
Renderable AbsolutePosition Source # | |
Defined in DzenDhall.AST.Render render :: AbsolutePosition -> Render () Source # | |
Renderable Color Source # | |
Renderable ClickableArea Source # | |
Defined in DzenDhall.AST.Render render :: ClickableArea -> Render () Source # | |
Renderable Shape Source # | |
Renderable AST Source # | |
Renderable IgnoreBackground Source # | |
Defined in DzenDhall.AST.Render render :: IgnoreBackground -> Render () Source # |
Helper functions
usingStackWithTag :: Renderable a => Stack a -> Text -> a -> AST -> Render () Source #
^fg()
, ^bg()
and ^ib()
are rendered using the same algorithm.