Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Patat.Presentation.Syntax
Synopsis
- data Block
- = Plain ![Inline]
- | Para ![Inline]
- | LineBlock ![[Inline]]
- | CodeBlock !Attr !Text
- | RawBlock !Format !Text
- | BlockQuote ![Block]
- | OrderedList !ListAttributes ![[Block]]
- | BulletList ![[Block]]
- | DefinitionList ![([Inline], [[Block]])]
- | Header Int !Attr ![Inline]
- | HorizontalRule
- | Table ![Inline] ![Alignment] ![[Block]] ![[[Block]]]
- | Figure !Attr ![Block]
- | Div !Attr ![Block]
- | Reveal !RevealWrapper !(RevealSequence [Block])
- | VarBlock !Var
- | SpeakerNote !Text
- | Config !(Either String PresentationSettings)
- data Inline
- = Str !Text
- | Emph ![Inline]
- | Underline ![Inline]
- | Strong ![Inline]
- | Strikeout ![Inline]
- | Superscript ![Inline]
- | Subscript ![Inline]
- | SmallCaps ![Inline]
- | Quoted !QuoteType ![Inline]
- | Cite ![Citation] ![Inline]
- | Code !Attr !Text
- | Space
- | SoftBreak
- | LineBreak
- | Math !MathType !Text
- | RawInline !Format !Text
- | Link !Attr ![Inline] !Target
- | Image !Attr ![Inline] !Target
- | Note ![Block]
- | Span !Attr ![Inline]
- dftBlocks :: forall m. Monad m => (Block -> m [Block]) -> (Inline -> m [Inline]) -> [Block] -> m [Block]
- dftInlines :: forall m. Monad m => (Block -> m [Block]) -> (Inline -> m [Inline]) -> [Inline] -> m [Inline]
- fromPandocBlocks :: [Block] -> [Block]
- fromPandocInlines :: [Inline] -> [Inline]
- isHorizontalRule :: Block -> Bool
- isComment :: Block -> Bool
- newtype Var = Var Unique
- variables :: [Block] -> HashSet Var
- newtype RevealID = RevealID Unique
- blocksRevealSteps :: [Block] -> Int
- blocksRevealStep :: Int -> [Block] -> RevealState
- blocksRevealLastStep :: [Block] -> RevealState
- blocksRevealOrder :: [Block] -> [RevealID]
- blocksReveal :: RevealState -> [Block] -> [Block]
- type RevealState = Map RevealID Int
- revealToBlocks :: RevealState -> RevealWrapper -> RevealSequence [Block] -> [Block]
- data RevealWrapper
- revealWrapper :: RevealWrapper -> [[Block]] -> [Block]
- data RevealSequence a = RevealSequence {}
Documentation
This is similar to Block
. Having our own datatype has some
advantages:
- We can extend it with slide-specific data (eval, reveals)
- We can remove stuff we don't care about
- We can parse attributes and move them to haskell datatypes
- This conversion can happen in a single parsing phase
- We can catch backwards-incompatible pandoc changes in this module
We try to follow the naming conventions from Pandoc as much as possible.
Constructors
Plain ![Inline] | |
Para ![Inline] | |
LineBlock ![[Inline]] | |
CodeBlock !Attr !Text | |
RawBlock !Format !Text | |
BlockQuote ![Block] | |
OrderedList !ListAttributes ![[Block]] | |
BulletList ![[Block]] | |
DefinitionList ![([Inline], [[Block]])] | |
Header Int !Attr ![Inline] | |
HorizontalRule | |
Table ![Inline] ![Alignment] ![[Block]] ![[[Block]]] | |
Figure !Attr ![Block] | |
Div !Attr ![Block] | |
Reveal !RevealWrapper !(RevealSequence [Block]) | |
VarBlock !Var | |
SpeakerNote !Text | |
Config !(Either String PresentationSettings) |
See comment on Block
.
Constructors
Str !Text | |
Emph ![Inline] | |
Underline ![Inline] | |
Strong ![Inline] | |
Strikeout ![Inline] | |
Superscript ![Inline] | |
Subscript ![Inline] | |
SmallCaps ![Inline] | |
Quoted !QuoteType ![Inline] | |
Cite ![Citation] ![Inline] | |
Code !Attr !Text | |
Space | |
SoftBreak | |
LineBreak | |
Math !MathType !Text | |
RawInline !Format !Text | |
Link !Attr ![Inline] !Target | |
Image !Attr ![Inline] !Target | |
Note ![Block] | |
Span !Attr ![Inline] |
Instances
dftBlocks :: forall m. Monad m => (Block -> m [Block]) -> (Inline -> m [Inline]) -> [Block] -> m [Block] Source #
Depth-First Traversal of blocks (and inlines).
dftInlines :: forall m. Monad m => (Block -> m [Block]) -> (Inline -> m [Inline]) -> [Inline] -> m [Inline] Source #
Depth-First Traversal of inlines (and blocks).
fromPandocBlocks :: [Block] -> [Block] Source #
fromPandocInlines :: [Inline] -> [Inline] Source #
isHorizontalRule :: Block -> Bool Source #
A variable is like a placeholder in the instructions, something we don't know yet, dynamic content. Currently this is only used for code evaluation.
A counter is used to change state in a slide. As counters increment, content may deterministically show or hide.
blocksRevealSteps :: [Block] -> Int Source #
Number of reveal steps in some blocks.
blocksRevealStep :: Int -> [Block] -> RevealState Source #
Construct the reveal state for a specific step.
blocksRevealLastStep :: [Block] -> RevealState Source #
Construct the final reveal state.
blocksRevealOrder :: [Block] -> [RevealID] Source #
This does a deep traversal of some blocks, and returns all reveals that should be advanced in-order.
blocksReveal :: RevealState -> [Block] -> [Block] Source #
Apply revealToBlocks
recursively at each position, removing reveals
in favor of their currently visible content.
revealToBlocks :: RevealState -> RevealWrapper -> RevealSequence [Block] -> [Block] Source #
Render a reveal by applying its constructor to what is visible.
data RevealWrapper Source #
This determines how we construct content based on the visible items. This could also be represented as `[[Block]] -> [Block]` but then we lose the convenient Eq and Show instances.
Instances
Show RevealWrapper Source # | |
Defined in Patat.Presentation.Syntax Methods showsPrec :: Int -> RevealWrapper -> ShowS # show :: RevealWrapper -> String # showList :: [RevealWrapper] -> ShowS # | |
Eq RevealWrapper Source # | |
Defined in Patat.Presentation.Syntax Methods (==) :: RevealWrapper -> RevealWrapper -> Bool # (/=) :: RevealWrapper -> RevealWrapper -> Bool # |
revealWrapper :: RevealWrapper -> [[Block]] -> [Block] Source #
data RevealSequence a Source #
A reveal sequence stores content which can be hidden or shown depending on a counter state.
The easiest example to think about is a bullet list which appears incrmentally on a slide. Initially, the counter state is 0. As it is incremented (the user goes to the next fragment in the slide), more list items become visible.