aboutsummaryrefslogtreecommitdiff
path: root/Text/Pandoc/Writers/RST.hs
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-11-29 08:09:31 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-11-29 08:09:31 +0000
commit03f4a665ffbf8f8aeba6b319649d6dcd0841bc1c (patch)
treebb8ce30e722a32543ca4113b6ccaa52d523747e7 /Text/Pandoc/Writers/RST.hs
parent132186e6b0cf06ee20334d885c55e9e357e0c3b2 (diff)
downloadpandoc-03f4a665ffbf8f8aeba6b319649d6dcd0841bc1c.tar.gz
Changed all writers to handle new Math block element.
This allows TeX element to be handled differently (and in many output formats, simply ignored). git-svn-id: https://pandoc.googlecode.com/svn/trunk@1118 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Text/Pandoc/Writers/RST.hs')
-rw-r--r--Text/Pandoc/Writers/RST.hs8
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 ' '