From eaba313fb3a0d6367b0eecc2b22218f14c1e1f74 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Tue, 15 Mar 2022 15:35:51 +0100 Subject: Writers.GridTable: improve module documentation. --- src/Text/Pandoc/Writers/GridTable.hs | 10 ++++++++-- src/Text/Pandoc/Writers/Shared.hs | 13 +++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src') 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 -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 -- cgit v1.2.3