From 91afa513ad495bdc277c94ac2a4a4b829423f222 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Thu, 18 Aug 2016 14:32:59 +0200 Subject: [PATCH] Org writer: remove blank line after figure caption Org-mode only treats an image as a figure if it is directly preceded by a caption. --- src/Text/Pandoc/Writers/Org.hs | 5 ++--- tests/writer.org | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs index e903e9e42..283bb7d9c 100644 --- a/src/Text/Pandoc/Writers/Org.hs +++ b/src/Text/Pandoc/Writers/Org.hs @@ -158,10 +158,9 @@ blockToOrg (Plain inlines) = inlineListToOrg inlines blockToOrg (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do capt <- if null txt then return empty - else (\c -> "#+CAPTION: " <> c <> blankline) `fmap` - inlineListToOrg txt + else ("#+CAPTION: " <>) `fmap` inlineListToOrg txt img <- inlineToOrg (Image attr txt (src,tit)) - return $ capt <> img + return $ capt $$ img blockToOrg (Para inlines) = do contents <- inlineListToOrg inlines return $ contents <> blankline diff --git a/tests/writer.org b/tests/writer.org index cf6305ec9..100328c2c 100644 --- a/tests/writer.org +++ b/tests/writer.org @@ -808,7 +808,6 @@ Auto-links should not occur here: == From "Voyage dans la Lune" by Georges Melies (1902): #+CAPTION: lalune - [[lalune.jpg]] Here is a movie [[movie.jpg]] icon.