Skip to content

Commit

Permalink
Typst reader: fix #quote attribution.
Browse files Browse the repository at this point in the history
If attribution is not present, don't print the `--`.

See #10320.
  • Loading branch information
jgm committed Oct 22, 2024
1 parent 461f760 commit a67584a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Text/Pandoc/Readers/Typst.hs
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,11 @@ blockHandlers = M.fromList
,("quote", \_ fields -> do
getField "block" fields >>= guard
body <- getField "body" fields >>= pWithContents pBlocks
attribution <-
((\x -> B.para ("\x2014\xa0" <> x)) <$>
(getField "attribution" fields >>= pWithContents pInlines))
<|> pure mempty
attribution' <- getField "attribution" fields
attribution <- if attribution' == mempty
then pure mempty
else (\x -> B.para ("\x2014\xa0" <> x)) <$>
(pWithContents pInlines attribution')
pure $ B.blockQuote $ body <> attribution)
,("list", \_ fields -> do
children <- V.toList <$> getField "children" fields
Expand Down

0 comments on commit a67584a

Please sign in to comment.