aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-11-15 21:16:27 -0800
committerJohn MacFarlane <[email protected]>2023-11-15 21:17:06 -0800
commit3591733e19f3a8db200c6170e6e543eb97e91728 (patch)
tree7801c926bb8115398fce93f95497777b47d32910 /src
parent13e1b49224ccd5a70af8f3b99b9a5ed6b9dfc48c (diff)
Typst writer: better handling of tables with captions.
We now put these in a figure with a caption argument. Closes #9194.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Typst.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Typst.hs b/src/Text/Pandoc/Writers/Typst.hs
index 159174baf..10948e2ab 100644
--- a/src/Text/Pandoc/Writers/Typst.hs
+++ b/src/Text/Pandoc/Writers/Typst.hs
@@ -165,14 +165,15 @@ blockToTypst block =
then return mempty
else do
captcontents <- inlinesToTypst caption
- return $ "#align(center, " <> brackets captcontents <> ")"
+ return $ ", caption: " <> brackets captcontents
let lab = toLabel ident
let formatalign AlignLeft = "left,"
formatalign AlignRight = "right,"
formatalign AlignCenter = "center,"
formatalign AlignDefault = "auto,"
let alignarray = parens $ mconcat $ map formatalign aligns
- return $ "#align(center)[#table("
+ return $ "#figure(" $$
+ "align(center)[#table("
$$ nest 2
( "columns: " <> text (show numcols) <> "," -- auto
$$ "align: (col, row) => " <> alignarray <> ".at(col),"
@@ -180,10 +181,10 @@ blockToTypst block =
$$ hsep (map ((<>",") . brackets) headers')
$$ vcat (map (\x -> brackets x <> ",") (concat rows'))
)
- $$ ")"
+ $$ ")]"
$$ capt'
+ $$ ")"
$$ lab
- $$ "]"
$$ blankline
Figure (ident,_,_) (Caption _mbshort capt) blocks -> do
caption <- blocksToTypst capt