Support Sphinx-style math in RST writer.

http://sphinx.pocoo.org/latest/ext/math.html
This commit is contained in:
John MacFarlane 2011-12-30 23:51:49 -08:00
parent d8272d0356
commit c7f6f77908

View file

@ -286,8 +286,9 @@ inlineToRST (Str str) = return $ text $ escapeString str
inlineToRST (Math t str) = do
modify $ \st -> st{ stHasMath = True }
return $ if t == InlineMath
then ":math:`$" <> text str <> "$`"
else ":math:`$$" <> text str <> "$$`"
then ":math:`" <> text str <> "`\\ "
else blankline $$ ".. math::" $$ blankline $$
nest 3 (text str) $$ blankline
inlineToRST (RawInline _ _) = return empty
inlineToRST (LineBreak) = return cr -- there's no line break in RST
inlineToRST Space = return space