diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-01-13 20:24:34 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-01-13 20:24:34 -0800 |
commit | f191aa4a986d2f60a73df28d343c9848a5c38c64 (patch) | |
tree | 5e1ed2fcacd25c32aa3c35b56129c5d306751893 /src/Text/Pandoc/Writers | |
parent | cc9fb46fa69ee717e2170bd1f57feb1df3f64a5b (diff) | |
download | pandoc-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.hs | 13 |
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 |