git.iko.soy/typeable/pandoc
on master help sign in
Org reader: allow figure with empty caption
462c140Albert Krewinkel
src/Text/Pandoc/Readers/Org/Blocks.hs+1−3
@@ -288,9 +288,7 @@ blockAttributes = try $ do
288 let kvAttrs = foldl' (appendValues "ATTR_HTML") Nothing kv
288 let kvAttrs = foldl' (appendValues "ATTR_HTML") Nothing kv
289 let name = lookup "NAME" kv
289 let name = lookup "NAME" kv
290 let label = lookup "LABEL" kv
290 let label = lookup "LABEL" kv
291− caption' <- maybe (return Nothing)
292− (fmap Just . parseFromString inlines)
291+ caption' <- sequence (parseFromString inlines . (++ "\n") <$> caption)
293− caption
294 kvAttrs' <- parseFromString keyValues . (++ "\n") $ fromMaybe mempty kvAttrs
292 kvAttrs' <- parseFromString keyValues . (++ "\n") $ fromMaybe mempty kvAttrs
295 return $ BlockAttributes
293 return $ BlockAttributes
296 { blockAttrName = name
294 { blockAttrName = name
tests/Tests/Readers/Org.hs+6
@@ -916,6 +916,12 @@ tests =
916 ] =?>
916 ] =?>
917 let attr = ("fig:myfig", mempty, mempty)
917 let attr = ("fig:myfig", mempty, mempty)
918 in para (imageWith attr "blub.png" "fig:" "My figure")
918 in para (imageWith attr "blub.png" "fig:" "My figure")
919+
920+ , "Figure with empty caption" =:
921+ unlines [ "#+CAPTION:"
922+ , "[[file:guess.jpg]]"
923+ ] =?>
924+ para (image "guess.jpg" "fig:" "")
919 ]
925 ]
920
926
921 , "Footnote" =:
927 , "Footnote" =: