@@ -143,9 +143,12 @@ pictToRST (label, (attr, src, _, mbtarget)) = do
143143 let (_, cls, _) = attr
144144 classes = case cls of
145145 [] -> empty
146− ["align-right"] -> ":align: right"
147− ["align-left"] -> ":align: left"
148− ["align-center"] -> ":align: center"
146+ ["align-top"] -> ":align: top"
147+ ["align-middle"] -> ":align: middle"
148+ ["align-bottom"] -> ":align: bottom"
149+ ["align-center"] -> empty
150+ ["align-right"] -> empty
151+ ["align-left"] -> empty
149152 _ -> ":class: " <> literal (T.unwords cls)
150153 return $ nowrap
151154 $ ".. |" <> label' <> "| image:: " <> literal src $$ hang 3 empty (classes $$ dims)
@@ -215,19 +218,28 @@ blockToRST (Div (ident,classes,_kvs) bs) = do
215218 nest 3 contents $$
216219 blankline
217220blockToRST (Plain inlines) = inlineListToRST inlines
218−-- title beginning with fig: indicates that the image is a figure
219−blockToRST (Para [Image attr txt (src,T.stripPrefix "fig:" -> Just tit)]) = do
220− capt <- inlineListToRST txt
221+blockToRST (Para [Image attr txt (src, rawtit)]) = do
222+ description <- inlineListToRST txt
221223 dims <- imageDimsToRST attr
222− let fig = "figure:: " <> literal src
223− alt = ":alt: " <> if T.null tit then capt else literal tit
224+ -- title beginning with fig: indicates that the image is a figure
225+ let (isfig, tit) = case T.stripPrefix "fig:" rawtit of
226+ Nothing -> (False, rawtit)
227+ Just tit' -> (True, tit')
228+ let fig | isfig = "figure:: " <> literal src
229+ | otherwise = "image:: " <> literal src
230+ alt | isfig = ":alt: " <> if T.null tit then description else literal tit
231+ | null txt = empty
232+ | otherwise = ":alt: " <> description
233+ capt | isfig = description
234+ | otherwise = empty
224235 (_,cls,_) = attr
225236 classes = case cls of
226237 [] -> empty
227238 ["align-right"] -> ":align: right"
228239 ["align-left"] -> ":align: left"
229240 ["align-center"] -> ":align: center"
230− _ -> ":figclass: " <> literal (T.unwords cls)
241+ _ | isfig -> ":figclass: " <> literal (T.unwords cls)
242+ | otherwise -> ":class: " <> literal (T.unwords cls)
231243 return $ hang 3 ".. " (fig $$ alt $$ classes $$ dims $+$ capt) $$ blankline
232244blockToRST (Para inlines)
233245 | LineBreak `elem` inlines =