aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-07-06 09:46:08 -0700
committerJohn MacFarlane <[email protected]>2023-07-06 09:46:08 -0700
commitca7101765ce7c2333b7377d9334be7b6b85fec9a (patch)
tree128d2d179b3e4ec9c867fd36618ad6c39e50c133 /src/Text
parent4d2924032d542e32060f347ca2ab0b92f5cab4ba (diff)
Typst reader: allow block-level content in text element.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Typst.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Typst.hs b/src/Text/Pandoc/Readers/Typst.hs
index bff232722..4d68b431e 100644
--- a/src/Text/Pandoc/Readers/Typst.hs
+++ b/src/Text/Pandoc/Readers/Typst.hs
@@ -107,6 +107,11 @@ handleBlock tok = do
case tok of
Txt {} -> fail "pBlockElt encountered Txt"
Lab {} -> pure mempty
+ Elt "text" _ fields -> do
+ body <- getField "body" fields
+ -- sometimes text elements include para breaks
+ notFollowedBy $ void $ pWithContents pInlines body
+ pWithContents pBlocks body
Elt "heading" _ fields -> do
body <- getField "body" fields
lev <- getField "level" fields <|> pure 1
@@ -331,6 +336,7 @@ isInline (Lab {}) = True
isInline (Txt {}) = True
isInline (Elt "place" _ _) = True -- can be block or inline
isInline (Elt "align" _ _) = True -- can be block or inline
+isInline (Elt "text" _ _) = True -- can be block or inline
isInline x = not (isBlock x)
isBlock :: Content -> Bool
@@ -338,6 +344,7 @@ isBlock (Txt {}) = False
isBlock (Lab {}) = True
isBlock (Elt name _ fields) =
case name of
+ "text" -> True -- can be block or inline
"align" -> True
"bibliography" -> True
"block" -> True