aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-08-09 11:37:39 -0700
committerJohn MacFarlane <[email protected]>2023-08-09 11:38:38 -0700
commitcc371a9485241db3e0101180432e2122d023a9bd (patch)
tree2882f2d10e8b17a78fef6282dca5e7a976619183 /src
parente611edb7d86af665830a34bb3ee2ff049eda0976 (diff)
Typst writer: put the label in right place for Div, use `#block`.
Closes #8991. Previously we were putting the label at the beginning of the Div's contents, but according to the documentation such a label gets attached to the *preceding* element. We now use an explicit `#block` and add the label at the end.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Typst.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Typst.hs b/src/Text/Pandoc/Writers/Typst.hs
index 53edbcb0c..8cd64d2ac 100644
--- a/src/Text/Pandoc/Writers/Typst.hs
+++ b/src/Text/Pandoc/Writers/Typst.hs
@@ -189,10 +189,12 @@ blockToTypst block =
return $ "#figure(" <> nest 2 (brackets contents <> "," <> cr <>
("caption: [" $$ nest 2 caption $$ "]"))
$$ ")" $$ lab $$ blankline
+ Div (ident,_,_) (Header lev ("",cls,kvs) ils:rest) ->
+ blocksToTypst (Header lev (ident,cls,kvs) ils:rest)
Div (ident,_,_) blocks -> do
let lab = toLabel ident
contents <- blocksToTypst blocks
- return $ lab $$ contents
+ return $ "#block[" $$ contents $$ ("]" <+> lab)
defListItemToTypst :: PandocMonad m => ([Inline], [[Block]]) -> TW m (Doc Text)
defListItemToTypst (term, defns) = do