diff options
| author | Albert Krewinkel <albert@zeitkraut.de> | 2022-03-15 15:35:51 +0100 |
|---|---|---|
| committer | Albert Krewinkel <albert@zeitkraut.de> | 2022-03-18 14:16:03 +0100 |
| commit | eaba313fb3a0d6367b0eecc2b22218f14c1e1f74 (patch) | |
| tree | 19b82c46d1b3838d6cc942f45ce0fb90a24a8b96 /src/Text | |
| parent | 43e549b2fb305519b773d44e7036a71361a36f4e (diff) | |
Writers.GridTable: improve module documentation.
Diffstat (limited to 'src/Text')
| -rw-r--r-- | src/Text/Pandoc/Writers/GridTable.hs | 10 | ||||
| -rw-r--r-- | src/Text/Pandoc/Writers/Shared.hs | 13 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Writers/GridTable.hs b/src/Text/Pandoc/Writers/GridTable.hs index fcaedddcd..529b2fad7 100644 --- a/src/Text/Pandoc/Writers/GridTable.hs +++ b/src/Text/Pandoc/Writers/GridTable.hs @@ -10,7 +10,13 @@ License : GNU GPL, version 2 or above Maintainer : Albert Krewinkel <albert@zeitkraut.de> -Grid representation of pandoc tables. +Grid representation of pandoc tables. The structures in this module +allow to describe 'Text.Pandoc.Definition.Table' elements without loss +of information. However, they are simpler to use when the grid layout of +a table must be known. + +The "grid tables" handled here are conceptually similar to grid tables +in reStructuredText and Markdown, but are more general. -} module Text.Pandoc.Writers.GridTable ( Table (..) @@ -97,7 +103,7 @@ data BuilderCell fromBuilderCell :: BuilderCell -> GridCell fromBuilderCell = \case FilledCell c -> c - FreeCell -> error "Found an unassigned cell." + FreeCell -> error "Found an unassigned cell. Please report this as a bug!" rowsToPart :: Attr -> [B.Row] -> Part rowsToPart attr = \case diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs index 799e7843f..7cf72ae8c 100644 --- a/src/Text/Pandoc/Writers/Shared.hs +++ b/src/Text/Pandoc/Writers/Shared.hs @@ -231,14 +231,15 @@ unsmartify opts = T.concatMap $ \c -> case c of '\8216' -> "'" _ -> T.singleton c +-- | Writes a grid table. gridTable :: (Monad m, HasChars a) => WriterOptions - -> (WriterOptions -> [Block] -> m (Doc a)) - -> Bool -- ^ headless - -> [Alignment] - -> [Double] - -> [[Block]] - -> [[[Block]]] + -> (WriterOptions -> [Block] -> m (Doc a)) -- ^ format Doc writer + -> Bool -- ^ headless + -> [Alignment] -- ^ column alignments + -> [Double] -- ^ column widths + -> [[Block]] -- ^ table header row + -> [[[Block]]] -- ^ table body rows -> m (Doc a) gridTable opts blocksToDoc headless aligns widths headers rows = do -- the number of columns will be used in case of even widths |
