summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/MediaWiki.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-08-04 11:34:01 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2012-08-04 11:34:01 -0700
commit3f913c0cc504e574ffb2b8fd6f0a460fc606b74d (patch)
treec1bd4ec58f6be94e3278d214e76c5e119a3f72fe /src/Text/Pandoc/Writers/MediaWiki.hs
parentc19c6fdc505a8cd89dccdfa28bc28125d8b3a247 (diff)
Don't include empty captions in figures.
Closes #581.
Diffstat (limited to 'src/Text/Pandoc/Writers/MediaWiki.hs')
-rw-r--r--src/Text/Pandoc/Writers/MediaWiki.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs
index 6af2febf5..84d7393c1 100644
--- a/src/Text/Pandoc/Writers/MediaWiki.hs
+++ b/src/Text/Pandoc/Writers/MediaWiki.hs
@@ -82,11 +82,12 @@ blockToMediaWiki opts (Plain inlines) =
inlineListToMediaWiki opts inlines
blockToMediaWiki opts (Para [Image txt (src,tit)]) = do
- capt <- inlineListToMediaWiki opts txt
+ capt <- if null txt
+ then return ""
+ else ("|caption " ++) `fmap` inlineListToMediaWiki opts txt
let opt = if null txt
then ""
- else "|alt=" ++ if null tit then capt else tit ++
- "|caption " ++ capt
+ else "|alt=" ++ if null tit then capt else tit ++ capt
return $ "[[Image:" ++ src ++ "|frame|none" ++ opt ++ "]]\n"
blockToMediaWiki opts (Para inlines) = do