Skip to content

Commit

Permalink
Handle case where height but not width is provided.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgm committed Oct 20, 2023
1 parent fb9228d commit b70e3e2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Text/Pandoc/Writers/Typst.hs
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,13 @@ inlineToTypst inline =
parens (doubleQuoted src <>
maybe mempty (\w -> ", width: " <> literal w) width' <>
maybe mempty (\h -> ", height: " <> literal h) height')
case width' of
Nothing -> return $ "#" <> coreImage
case (width', height') of
(Nothing, Nothing) -> return $ "#" <> coreImage
-- see #9104; we need a box or the image is treated as block-level:
Just w -> return $ "#box" <>
parens ("width: " <> literal w <> ", " <> coreImage)
(Just w, _) -> return $ "#box" <>
parens ("width: " <> literal w <> ", " <> coreImage)
(_, Just h) -> return $ "#box" <>
parens ("height: " <> literal h <> ", " <> coreImage)
Note blocks -> do
contents <- blocksToTypst blocks
return $ "#footnote" <> brackets (chomp contents)
Expand Down

0 comments on commit b70e3e2

Please sign in to comment.