Copyright | Copyright 2020 Christian Despres |
---|---|
License | GNU GPL, version 2 or above |
Maintainer | Christian Despres <christian.j.j.despres@gmail.com> |
Stability | alpha |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Text.Pandoc.Writers.AnnotatedTable
Description
Synopsis
- toTable :: Attr -> Caption -> [ColSpec] -> TableHead -> [TableBody] -> TableFoot -> Table
- fromTable :: Table -> (Attr, Caption, [ColSpec], TableHead, [TableBody], TableFoot)
- data Table = Table Attr Caption [ColSpec] TableHead [TableBody] TableFoot
- data TableHead = TableHead Attr [HeaderRow]
- data TableBody = TableBody Attr RowHeadColumns [HeaderRow] [BodyRow]
- data TableFoot = TableFoot Attr [HeaderRow]
- data HeaderRow = HeaderRow Attr RowNumber [Cell]
- data BodyRow = BodyRow Attr RowNumber RowHead RowBody
- newtype RowNumber = RowNumber Int
- type RowHead = [Cell]
- type RowBody = [Cell]
- data Cell = Cell (NonEmpty ColSpec) ColNumber Cell
- newtype ColNumber = ColNumber Int
Documentation
toTable :: Attr -> Caption -> [ColSpec] -> TableHead -> [TableBody] -> TableFoot -> Table #
Convert a Pandoc Table
to an annotated Table
. This function
also performs the same normalization that the table
builder
does (fixing overlapping cells, cells that protrude out of their
table section, and so on). If the input table happens to satisfy
the conditions that table
guarantees, then the resulting
Table
will be identical, save for the addition of the inferred
table information.
An annotated table type, corresponding to the Pandoc Table
constructor and the HTML <table>
element. It records the data
of the columns that cells span, the cells in the row head, the row
numbers of rows, and the column numbers of cells, in addition to
the data in a Table
. The type itself does not enforce any
guarantees about the consistency of this data. Use toTable
to
produce a Table
from a Pandoc Table
.
Instances
Data Table # | |
Defined in Text.Pandoc.Writers.AnnotatedTable Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Table -> c Table # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Table # dataTypeOf :: Table -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Table) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Table) # gmapT :: (forall b. Data b => b -> b) -> Table -> Table # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Table -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Table -> r # gmapQ :: (forall d. Data d => d -> u) -> Table -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Table -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Table -> m Table # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Table -> m Table # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Table -> m Table # | |
Generic Table # | |
Read Table # | |
Show Table # | |
Eq Table # | |
Ord Table # | |
type Rep Table # | |
Defined in Text.Pandoc.Writers.AnnotatedTable type Rep Table = D1 ('MetaData "Table" "Text.Pandoc.Writers.AnnotatedTable" "pandoc-3.1.9-Dm3h6SJz7b52zGo8xZIABi" 'False) (C1 ('MetaCons "Table" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Attr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Caption) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ColSpec]))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TableHead) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TableBody]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TableFoot))))) |
An annotated table head, corresponding to a Pandoc TableHead
and the HTML <thead>
element.
Instances
Data TableHead # | |
Defined in Text.Pandoc.Writers.AnnotatedTable Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TableHead -> c TableHead # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TableHead # toConstr :: TableHead -> Constr # dataTypeOf :: TableHead -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TableHead) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TableHead) # gmapT :: (forall b. Data b => b -> b) -> TableHead -> TableHead # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TableHead -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TableHead -> r # gmapQ :: (forall d. Data d => d -> u) -> TableHead -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TableHead -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TableHead -> m TableHead # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TableHead -> m TableHead # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TableHead -> m TableHead # | |
Generic TableHead # | |
Read TableHead # | |
Show TableHead # | |
Eq TableHead # | |
Ord TableHead # | |
Defined in Text.Pandoc.Writers.AnnotatedTable | |
Walkable a Cell => Walkable a TableHead # | |
type Rep TableHead # | |
Defined in Text.Pandoc.Writers.AnnotatedTable type Rep TableHead = D1 ('MetaData "TableHead" "Text.Pandoc.Writers.AnnotatedTable" "pandoc-3.1.9-Dm3h6SJz7b52zGo8xZIABi" 'False) (C1 ('MetaCons "TableHead" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Attr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [HeaderRow]))) |
An annotated table body, with an intermediate head and body,
corresponding to a Pandoc TableBody
and the HTML <tbody>
element.
Constructors
TableBody Attr RowHeadColumns [HeaderRow] [BodyRow] |
Instances
Data TableBody # | |
Defined in Text.Pandoc.Writers.AnnotatedTable Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TableBody -> c TableBody # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TableBody # toConstr :: TableBody -> Constr # dataTypeOf :: TableBody -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TableBody) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TableBody) # gmapT :: (forall b. Data b => b -> b) -> TableBody -> TableBody # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TableBody -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TableBody -> r # gmapQ :: (forall d. Data d => d -> u) -> TableBody -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TableBody -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TableBody -> m TableBody # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TableBody -> m TableBody # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TableBody -> m TableBody # | |
Generic TableBody # | |
Read TableBody # | |
Show TableBody # | |
Eq TableBody # | |
Ord TableBody # | |
Defined in Text.Pandoc.Writers.AnnotatedTable | |
type Rep TableBody # | |
Defined in Text.Pandoc.Writers.AnnotatedTable type Rep TableBody = D1 ('MetaData "TableBody" "Text.Pandoc.Writers.AnnotatedTable" "pandoc-3.1.9-Dm3h6SJz7b52zGo8xZIABi" 'False) (C1 ('MetaCons "TableBody" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Attr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RowHeadColumns)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [HeaderRow]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [BodyRow])))) |
An annotated table foot, corresponding to a Pandoc TableFoot
and the HTML <tfoot>
element.
Instances
Data TableFoot # | |
Defined in Text.Pandoc.Writers.AnnotatedTable Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TableFoot -> c TableFoot # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TableFoot # toConstr :: TableFoot -> Constr # dataTypeOf :: TableFoot -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TableFoot) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TableFoot) # gmapT :: (forall b. Data b => b -> b) -> TableFoot -> TableFoot # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TableFoot -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TableFoot -> r # gmapQ :: (forall d. Data d => d -> u) -> TableFoot -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TableFoot -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TableFoot -> m TableFoot # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TableFoot -> m TableFoot # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TableFoot -> m TableFoot # | |
Generic TableFoot # | |
Read TableFoot # | |
Show TableFoot # | |
Eq TableFoot # | |
Ord TableFoot # | |
Defined in Text.Pandoc.Writers.AnnotatedTable | |
type Rep TableFoot # | |
Defined in Text.Pandoc.Writers.AnnotatedTable type Rep TableFoot = D1 ('MetaData "TableFoot" "Text.Pandoc.Writers.AnnotatedTable" "pandoc-3.1.9-Dm3h6SJz7b52zGo8xZIABi" 'False) (C1 ('MetaCons "TableFoot" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Attr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [HeaderRow]))) |
An annotated header row, corresponding to a Pandoc Row
and
the HTML <tr>
element, and also recording the row number of the
row. All the cells in a HeaderRow
are header (<th>
) cells.
Instances
Data HeaderRow # | |
Defined in Text.Pandoc.Writers.AnnotatedTable Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HeaderRow -> c HeaderRow # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c HeaderRow # toConstr :: HeaderRow -> Constr # dataTypeOf :: HeaderRow -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c HeaderRow) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HeaderRow) # gmapT :: (forall b. Data b => b -> b) -> HeaderRow -> HeaderRow # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HeaderRow -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HeaderRow -> r # gmapQ :: (forall d. Data d => d -> u) -> HeaderRow -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HeaderRow -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HeaderRow -> m HeaderRow # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HeaderRow -> m HeaderRow # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HeaderRow -> m HeaderRow # | |
Generic HeaderRow # | |
Read HeaderRow # | |
Show HeaderRow # | |
Eq HeaderRow # | |
Ord HeaderRow # | |
Defined in Text.Pandoc.Writers.AnnotatedTable | |
Walkable a Cell => Walkable a HeaderRow # | |
type Rep HeaderRow # | |
Defined in Text.Pandoc.Writers.AnnotatedTable type Rep HeaderRow = D1 ('MetaData "HeaderRow" "Text.Pandoc.Writers.AnnotatedTable" "pandoc-3.1.9-Dm3h6SJz7b52zGo8xZIABi" 'False) (C1 ('MetaCons "HeaderRow" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Attr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RowNumber) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Cell])))) |
An annotated body row, corresponding to a Pandoc Row
and the
HTML <tr>
element, and also recording its row number and
separating the row head cells from the row body cells.
Instances
Data BodyRow # | |
Defined in Text.Pandoc.Writers.AnnotatedTable Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> BodyRow -> c BodyRow # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c BodyRow # toConstr :: BodyRow -> Constr # dataTypeOf :: BodyRow -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c BodyRow) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BodyRow) # gmapT :: (forall b. Data b => b -> b) -> BodyRow -> BodyRow # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BodyRow -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BodyRow -> r # gmapQ :: (forall d. Data d => d -> u) -> BodyRow -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> BodyRow -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> BodyRow -> m BodyRow # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> BodyRow -> m BodyRow # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> BodyRow -> m BodyRow # | |
Generic BodyRow # | |
Read BodyRow # | |
Show BodyRow # | |
Eq BodyRow # | |
Ord BodyRow # | |
Defined in Text.Pandoc.Writers.AnnotatedTable | |
type Rep BodyRow # | |
Defined in Text.Pandoc.Writers.AnnotatedTable type Rep BodyRow = D1 ('MetaData "BodyRow" "Text.Pandoc.Writers.AnnotatedTable" "pandoc-3.1.9-Dm3h6SJz7b52zGo8xZIABi" 'False) (C1 ('MetaCons "BodyRow" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Attr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RowNumber)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RowHead) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RowBody)))) |
The row number of a row. Note that rows are numbered continuously
from zero from the start of the table, so the first row in a table
body, for instance, may have a large RowNumber
.
Instances
The head of a body row; the portion of the row lying in the stub
of the TableBody
. Its cells correspond to HTML <th>
cells.
The body of a body row; the portion of the row lying after the
stub of the TableBody
. Its cells correspond to HTML <td>
cells.
An annotated table cell, wrapping a Pandoc Cell
with its
ColNumber
and the ColSpec
data for the columns that the cell
spans.
Instances
Data Cell # | |
Defined in Text.Pandoc.Writers.AnnotatedTable Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Cell -> c Cell # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Cell # dataTypeOf :: Cell -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Cell) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cell) # gmapT :: (forall b. Data b => b -> b) -> Cell -> Cell # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Cell -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Cell -> r # gmapQ :: (forall d. Data d => d -> u) -> Cell -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Cell -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Cell -> m Cell # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Cell -> m Cell # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Cell -> m Cell # | |
Generic Cell # | |
Read Cell # | |
Show Cell # | |
Eq Cell # | |
Ord Cell # | |
Walkable a Cell => Walkable a Cell # | |
type Rep Cell # | |
Defined in Text.Pandoc.Writers.AnnotatedTable type Rep Cell = D1 ('MetaData "Cell" "Text.Pandoc.Writers.AnnotatedTable" "pandoc-3.1.9-Dm3h6SJz7b52zGo8xZIABi" 'False) (C1 ('MetaCons "Cell" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty ColSpec)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ColNumber) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Cell)))) |
The column number of a cell, meaning the column number of the first column that the cell spans, if the table were laid on a grid. Columns are numbered starting from zero.