diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-08-13 11:00:28 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-08-13 11:00:28 -0700 |
commit | c3f17cb0d7d590c828214deda1d58e65da1b3812 (patch) | |
tree | 84412bfe99a8773362ab67735ef890b31105b155 /src/Text | |
parent | 91cc2492fac8ebfbb88d6873f834ca7c73a0f83f (diff) | |
download | pandoc-c3f17cb0d7d590c828214deda1d58e65da1b3812.tar.gz |
RST writer: use `.. container` for generic Divs, instead of raw HTML.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/RST.hs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs index 566bcbeef..7a299e4e9 100644 --- a/src/Text/Pandoc/Writers/RST.hs +++ b/src/Text/Pandoc/Writers/RST.hs @@ -211,11 +211,17 @@ blockToRST :: PandocMonad m => Block -- ^ Block element -> RST m Doc blockToRST Null = return empty -blockToRST (Div attr bs) = do +blockToRST (Div (ident,classes,_kvs) bs) = do contents <- blockListToRST bs - let startTag = ".. raw:: html" $+$ nest 3 (tagWithAttrs "div" attr) - let endTag = ".. raw:: html" $+$ nest 3 "</div>" - return $ blankline <> startTag $+$ contents $+$ endTag $$ blankline + let classes' = filter (/= "container") classes + return $ blankline $$ + (".. container::" <> space <> + text (unwords classes')) $$ + (if null ident + then blankline + else " :name: " <> text ident $$ blankline) $$ + nest 3 contents $$ + blankline blockToRST (Plain inlines) = inlineListToRST inlines -- title beginning with fig: indicates that the image is a figure blockToRST (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do |