diff options
| -rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 10 | ||||
| -rw-r--r-- | test/command/10758.md | 21 |
2 files changed, 28 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index c2e7e7f5e..a25e2761a 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -709,16 +709,20 @@ blockToMarkdown' opts (DefinitionList items) = do return $ mconcat contents <> blankline blockToMarkdown' opts (Figure figattr capt body) = do let combinedAttr imgattr = case imgattr of - ("", cls, kv) | (figid, [], []) <- figattr -> Just (figid, cls, kv) + ("", cls, kv) + | (figid, [], []) <- figattr -> Just (figid, cls, kv) + | otherwise -> Just ("", cls, kv) _ -> Nothing let combinedAlt alt = case capt of Caption Nothing [] -> if null alt then Just [Str "image"] else Just alt Caption Nothing [Plain captInlines] - | captInlines == alt || null alt -> Just captInlines + | null alt || stringify captInlines == stringify alt + -> Just captInlines Caption Nothing [Para captInlines] - | captInlines == alt || null alt -> Just captInlines + | null alt || stringify captInlines == stringify alt + -> Just captInlines _ -> Nothing case body of [Plain [Image imgAttr alt (src, ttl)]] diff --git a/test/command/10758.md b/test/command/10758.md new file mode 100644 index 000000000..885d26413 --- /dev/null +++ b/test/command/10758.md @@ -0,0 +1,21 @@ +``` +% pandoc -f native -t markdown +[ Figure + ( "" , [] , [] ) + (Caption + Nothing + [ Para [ Str "Foo" , Space , Emph [ Str "emphasis" ] ] ]) + [ Plain + [ Image + ( "" + , [] + , [] + ) + [ Str "Foo" , Space , Str "emphasis" ] + ( "media/rId20.jpg" , "" ) + ] + ] +] +^D + +``` |
