aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Muse.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-04-11 09:51:03 -0700
committerJohn MacFarlane <[email protected]>2025-05-14 13:11:37 -0700
commit4ec69b2679b24ce426626a51b22e18b054f86ea6 (patch)
tree08cc6e9c95accc3bf23ae50ea6ff4cfab0cdf7c8 /src/Text/Pandoc/Writers/Muse.hs
parentbe9fbb3f6731dc6223816677aab6c64243511c8f (diff)
T.P.Writers.Shared: New version of `gridTable`.issue6344
This handles row and colspans. Partially addresses #6344. It also ensures that cells won't wrap text in places where it wouldn't normally wrap, even if this means making the cells wider than requested by the colspec. (Closes #9001. Closes 7641.) Parameters are different, so this is a breaking [API change]. Markdown, RST, and Muse writers have been adjusted to use the new `gridTable`.
Diffstat (limited to 'src/Text/Pandoc/Writers/Muse.hs')
-rw-r--r--src/Text/Pandoc/Writers/Muse.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs
index 3b01d2a12..47a5e55ad 100644
--- a/src/Text/Pandoc/Writers/Muse.hs
+++ b/src/Text/Pandoc/Writers/Muse.hs
@@ -265,12 +265,15 @@ blockToMuse (Header level (ident,_,_) inlines) = do
return $ blankline <> attr' $$ nowrap (header' <> contents) <> blankline
-- https://www.gnu.org/software/emacs-muse/manual/muse.html#Horizontal-Rules-and-Anchors
blockToMuse HorizontalRule = return $ blankline $$ "----" $$ blankline
-blockToMuse (Table _ blkCapt specs thead tbody tfoot) =
+blockToMuse (Table _ blkCapt specs thead@(TableHead hattr hrows) tbody tfoot) =
if isSimple && numcols > 1
then simpleTable caption headers rows
else do
opts <- asks envOptions
- gridTable opts blocksToDoc True (map (const AlignDefault) aligns) widths headers rows
+ let tbody' = case hrows of
+ [] -> tbody
+ _ -> TableBody nullAttr 0 [] hrows : tbody
+ gridTable opts blocksToDoc specs (TableHead hattr []) tbody' tfoot
where
(caption, aligns, widths, headers, rows) = toLegacyTable blkCapt specs thead tbody tfoot
blocksToDoc opts blocks =