@@ -211,12 +211,21 @@ blockToRST :: PandocMonad m
211 => Block -- ^ Block element
211 => Block -- ^ Block element
212 -> RST m Doc
212 -> RST m Doc
213blockToRST Null = return empty
213blockToRST Null = return empty
214+blockToRST (Div ("",["admonition-title"],[]) _) = return empty
215+ -- this is generated by the rst reader and can safely be
216+ -- omitted when we're generating rst
214blockToRST (Div (ident,classes,_kvs) bs) = do
217blockToRST (Div (ident,classes,_kvs) bs) = do
215 contents <- blockListToRST bs
218 contents <- blockListToRST bs
219+ let admonitions = ["attention","caution","danger","error","hint",
220+ "important","note","tip","warning","admonition"]
221+ let admonition = case classes of
223+ | cl `elem` admonitions
224+ -> ".. " <> text cl <> "::"
225+ cls -> ".. container::" <> space <>
216− let classes' = filter (/= "container") classes
226+ text (unwords (filter (/= "container") cls))
217 return $ blankline $$
227 return $ blankline $$
218− (".. container::" <> space <>
228+ admonition $$
219− text (unwords classes')) $$
220 (if null ident
229 (if null ident
221 then blankline
230 then blankline
222 else " :name: " <> text ident $$ blankline) $$
231 else " :name: " <> text ident $$ blankline) $$