From f191aa4a986d2f60a73df28d343c9848a5c38c64 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 13 Jan 2013 20:24:34 -0800 Subject: RST writer: Properly handle images with no alt text. Closes #678. --- src/Text/Pandoc/Writers/RST.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/Text') 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 -- cgit v1.2.3