aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2016-10-14 23:16:51 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2016-10-14 23:16:51 +0200
commit462c140eb6751bd7978bf74ebf3f38db3b0bd126 (patch)
tree743c80730eb8e937c2a5dfa2d8e9e93218e3ecc5 /src/Text
parent49b0b67b11b62032b2ade498c3efd5a762193d86 (diff)
downloadpandoc-462c140eb6751bd7978bf74ebf3f38db3b0bd126.tar.gz
Org reader: allow figure with empty caption
A `#+CAPTION` attribute before an image is enough to turn an image into a figure. This wasn't the case because the `parseFromString` function, which processes the caption value, would fail on empty values. Adding a newline character to the caption value fixes this. Fixes: #3161
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Org/Blocks.hs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Blocks.hs b/src/Text/Pandoc/Readers/Org/Blocks.hs
index d14c894e6..8d22beb33 100644
--- a/src/Text/Pandoc/Readers/Org/Blocks.hs
+++ b/src/Text/Pandoc/Readers/Org/Blocks.hs
@@ -288,9 +288,7 @@ blockAttributes = try $ do
let kvAttrs = foldl' (appendValues "ATTR_HTML") Nothing kv
let name = lookup "NAME" kv
let label = lookup "LABEL" kv
- caption' <- maybe (return Nothing)
- (fmap Just . parseFromString inlines)
- caption
+ caption' <- sequence (parseFromString inlines . (++ "\n") <$> caption)
kvAttrs' <- parseFromString keyValues . (++ "\n") $ fromMaybe mempty kvAttrs
return $ BlockAttributes
{ blockAttrName = name