aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-01-13 20:24:34 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-01-13 20:24:34 -0800
commitf191aa4a986d2f60a73df28d343c9848a5c38c64 (patch)
tree5e1ed2fcacd25c32aa3c35b56129c5d306751893 /src/Text/Pandoc/Writers
parentcc9fb46fa69ee717e2170bd1f57feb1df3f64a5b (diff)
downloadpandoc-f191aa4a986d2f60a73df28d343c9848a5c38c64.tar.gz
RST writer: Properly handle images with no alt text.
Closes #678.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/RST.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index 46e86add1..2ec2ef127 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -388,10 +388,11 @@ registerImage alt (src,tit) mbtarget = do
pics <- get >>= return . stImages
txt <- case lookup alt pics of
Just (s,t,mbt) | (s,t,mbt) == (src,tit,mbtarget) -> return alt
- _ | null alt || alt == [Str ""] -> return
- [Str $ "image" ++ show (length pics)]
- | otherwise -> do
- modify $ \st -> st { stImages =
- (alt, (src,tit, mbtarget)):stImages st }
- return alt
+ _ -> do
+ let alt' = if null alt || alt == [Str ""]
+ then [Str $ "image" ++ show (length pics)]
+ else alt
+ modify $ \st -> st { stImages =
+ (alt', (src,tit, mbtarget)):stImages st }
+ return alt'
inlineListToRST txt