@@ -143,9 +143,12 @@ pictToRST (label, (attr, src, _, mbtarget)) = do
143 let (_, cls, _) = attr
143 let (_, cls, _) = attr
144 classes = case cls of
144 classes = case cls of
145 [] -> empty
145 [] -> empty
146− ["align-right"] -> ":align: right"
146+ ["align-top"] -> ":align: top"
147+ ["align-middle"] -> ":align: middle"
148+ ["align-bottom"] -> ":align: bottom"
149+ ["align-center"] -> empty
150+ ["align-right"] -> empty
147− ["align-left"] -> ":align: left"
151+ ["align-left"] -> empty
148− ["align-center"] -> ":align: center"
149 _ -> ":class: " <> literal (T.unwords cls)
152 _ -> ":class: " <> literal (T.unwords cls)
150 return $ nowrap
153 return $ nowrap
151 $ ".. |" <> label' <> "| image:: " <> literal src $$ hang 3 empty (classes $$ dims)
154 $ ".. |" <> label' <> "| image:: " <> literal src $$ hang 3 empty (classes $$ dims)
@@ -215,19 +218,28 @@ blockToRST (Div (ident,classes,_kvs) bs) = do
215 nest 3 contents $$
218 nest 3 contents $$
216 blankline
219 blankline
217blockToRST (Plain inlines) = inlineListToRST inlines
220blockToRST (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
221+blockToRST (Para [Image attr txt (src, rawtit)]) = do
220− capt <- inlineListToRST txt
222+ description <- inlineListToRST txt
221 dims <- imageDimsToRST attr
223 dims <- imageDimsToRST attr
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')
222− let fig = "figure:: " <> literal src
228+ let fig | isfig = "figure:: " <> literal src
229+ | otherwise = "image:: " <> literal src
223− alt = ":alt: " <> if T.null tit then capt else literal tit
230+ alt | isfig = ":alt: " <> if T.null tit then description else literal tit
232+ | otherwise = ":alt: " <> description
233+ capt | isfig = description
224 (_,cls,_) = attr
235 (_,cls,_) = attr
225 classes = case cls of
236 classes = case cls of
226 [] -> empty
237 [] -> empty
227 ["align-right"] -> ":align: right"
238 ["align-right"] -> ":align: right"
228 ["align-left"] -> ":align: left"
239 ["align-left"] -> ":align: left"
229 ["align-center"] -> ":align: center"
240 ["align-center"] -> ":align: center"
230− _ -> ":figclass: " <> literal (T.unwords cls)
241+ _ | isfig -> ":figclass: " <> literal (T.unwords cls)
242+ | otherwise -> ":class: " <> literal (T.unwords cls)
231 return $ hang 3 ".. " (fig $$ alt $$ classes $$ dims $+$ capt) $$ blankline
243 return $ hang 3 ".. " (fig $$ alt $$ classes $$ dims $+$ capt) $$ blankline
232blockToRST (Para inlines)
244blockToRST (Para inlines)
233 | LineBreak `elem` inlines =
245 | LineBreak `elem` inlines =