git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #2646 from tarleb/org-figure-with-no-name
29706eeJohn MacFarlane
src/Text/Pandoc/Readers/Org.hs+3−3
@@ -2,7 +2,7 @@
2{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts, FlexibleInstances #-}
3{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts, FlexibleInstances #-}
4{-
4{-
5−Copyright (C) 2014-2015 Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
5+Copyright (C) 2014-2016 Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
6
6
7This program is free software; you can redistribute it and/or modify
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
8it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
21
22{- |
22{- |
23 Module : Text.Pandoc.Readers.Org
23 Module : Text.Pandoc.Readers.Org
24− Copyright : Copyright (C) 2014-2015 Albert Krewinkel
24+ Copyright : Copyright (C) 2014-2016 Albert Krewinkel
25 License : GNU GPL, version 2 or above
25 License : GNU GPL, version 2 or above
26
26
27 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
27 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
@@ -629,7 +629,7 @@ figure = try $ do
629 maybeNam <- lookupBlockAttribute "name"
629 maybeNam <- lookupBlockAttribute "name"
630 guard $ isJust maybeCap || isJust maybeNam
630 guard $ isJust maybeCap || isJust maybeNam
631 return ( fromMaybe mempty maybeCap
631 return ( fromMaybe mempty maybeCap
632− , maybe mempty withFigPrefix maybeNam )
632+ , withFigPrefix $ fromMaybe mempty maybeNam )
633 withFigPrefix cs =
633 withFigPrefix cs =
634 if "fig:" `isPrefixOf` cs
634 if "fig:" `isPrefixOf` cs
635 then cs
635 then cs
tests/Tests/Readers/Org.hs+4−4
@@ -639,11 +639,11 @@ tests =
639 ] =?>
639 ] =?>
640 para (image "edward.jpg" "fig:goodguy" "A very courageous man.")
640 para (image "edward.jpg" "fig:goodguy" "A very courageous man.")
641
641
642− , "Unnamed figure" =:
642+ , "Figure with no name" =:
643− unlines [ "#+caption: A great whistleblower."
643+ unlines [ "#+caption: I've been through the desert on this"
644− , "[[snowden.png]]"
644+ , "[[horse.png]]"
645 ] =?>
645 ] =?>
646− para (image "snowden.png" "" "A great whistleblower.")
646+ para (image "horse.png" "fig:" "I've been through the desert on this")
647
647
648 , "Figure with `fig:` prefix in name" =:
648 , "Figure with `fig:` prefix in name" =:
649 unlines [ "#+caption: Used as a metapher in evolutionary biology."
649 unlines [ "#+caption: Used as a metapher in evolutionary biology."