diff options
Diffstat (limited to 'Text/Pandoc/Writers/RST.hs')
-rw-r--r-- | Text/Pandoc/Writers/RST.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Text/Pandoc/Writers/RST.hs b/Text/Pandoc/Writers/RST.hs index ddcbf95c0..4a7242d1f 100644 --- a/Text/Pandoc/Writers/RST.hs +++ b/Text/Pandoc/Writers/RST.hs @@ -151,9 +151,10 @@ blockToRST :: WriterOptions -- ^ Options -> State WriterState Doc blockToRST opts Null = return empty blockToRST opts (Plain inlines) = wrappedRST opts inlines -blockToRST opts (Para [TeX str]) = +blockToRST opts (Para [Math str]) = let str' = if "\n" `isSuffixOf` str then str ++ "\n" else str ++ "\n\n" in - return $ hang (text "\n.. raw:: latex\n") 3 $ vcat $ map text (lines str') + return $ hang (text "\n.. raw:: latex\n") 3 $ text "\\[" <> + (vcat $ map text (lines str')) <> text "\\]" blockToRST opts (Para inlines) = do contents <- wrappedRST opts inlines return $ contents <> text "\n" @@ -285,7 +286,8 @@ inlineToRST opts Apostrophe = return $ char '\'' inlineToRST opts Ellipses = return $ text "..." inlineToRST opts (Code str) = return $ text $ "``" ++ str ++ "``" inlineToRST opts (Str str) = return $ text $ escapeString str -inlineToRST opts (TeX str) = return $ text str +inlineToRST opts (Math str) = return $ char '$' <> text str <> char '$' +inlineToRST opts (TeX str) = return empty inlineToRST opts (HtmlInline str) = return empty inlineToRST opts (LineBreak) = return $ char ' ' -- RST doesn't have linebreaks inlineToRST opts Space = return $ char ' ' |