aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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