git.iko.soy/typeable/pandoc
on master help sign in
RST writer: Properly handle images with no alt text.

Closes #678.

commitf191aa4a986d2f60a73df28d343c9848a5c38c64 authorJohn MacFarlane <fiddlosopher@gmail.com> dateSun 13 Jan 2013, 20:24 (14 years ago) parentcc9fb46
1 file changed+7−6
src/Text/Pandoc/Writers/RST.hs+7−6
src/Text/Pandoc/Writers/RST.hs+7−6
@@ -388,10 +388,11 @@ registerImage alt (src,tit) mbtarget = do
388388 pics <- get >>= return . stImages
389389 txt <- case lookup alt pics of
390390 Just (s,t,mbt) | (s,t,mbt) == (src,tit,mbtarget) -> return alt
391− _ | null alt || alt == [Str ""] -> return
392− [Str $ "image" ++ show (length pics)]
393− | otherwise -> do
394− modify $ \st -> st { stImages =
395− (alt, (src,tit, mbtarget)):stImages st }
396− return alt
391+ _ -> do
392+ let alt' = if null alt || alt == [Str ""]
393+ then [Str $ "image" ++ show (length pics)]
394+ else alt
395+ modify $ \st -> st { stImages =
396+ (alt', (src,tit, mbtarget)):stImages st }
397+ return alt'
397398 inlineListToRST txt