diff options
author | John MacFarlane <jgm@berkeley.edu> | 2010-04-26 23:04:29 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2010-04-26 23:04:29 -0700 |
commit | 4aaa1991fdf950e569b3a1565fc0e63a0261ae51 (patch) | |
tree | ee4672c2b4d7238a5eb5115637f2bf078a38ed65 | |
parent | c243e5b67b0a3be6a713c6120da24e5e65cb0357 (diff) | |
download | pandoc-4aaa1991fdf950e569b3a1565fc0e63a0261ae51.tar.gz |
Man writer: convert math to unicode when possible.
(As in other writers.)
-rw-r--r-- | src/Text/Pandoc/Writers/Man.hs | 5 | ||||
-rw-r--r-- | tests/writer.man | 15 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs index 77dead196..c74cd81f9 100644 --- a/src/Text/Pandoc/Writers/Man.hs +++ b/src/Text/Pandoc/Writers/Man.hs @@ -32,6 +32,7 @@ module Text.Pandoc.Writers.Man ( writeMan) where import Text.Pandoc.Definition import Text.Pandoc.Templates import Text.Pandoc.Shared +import Text.Pandoc.Readers.TeXMath import Text.Printf ( printf ) import Data.List ( isPrefixOf, intersperse, intercalate ) import Text.PrettyPrint.HughesPJ hiding ( Str ) @@ -301,9 +302,9 @@ inlineToMan _ Ellipses = return $ text "\\&..." inlineToMan _ (Code str) = return $ text $ "\\f[B]" ++ escapeCode str ++ "\\f[]" inlineToMan _ (Str str) = return $ text $ escapeString str -inlineToMan opts (Math InlineMath str) = inlineToMan opts (Code str) +inlineToMan opts (Math InlineMath str) = inlineListToMan opts $ readTeXMath str inlineToMan opts (Math DisplayMath str) = do - contents <- inlineToMan opts (Code str) + contents <- inlineListToMan opts $ readTeXMath str return $ text ".RS" $$ contents $$ text ".RE" inlineToMan _ (TeX _) = return empty inlineToMan _ (HtmlInline _) = return empty diff --git a/tests/writer.man b/tests/writer.man index 1048bc701..e9d950bc4 100644 --- a/tests/writer.man +++ b/tests/writer.man @@ -544,23 +544,22 @@ Ellipses\&...and\&...and\&.... .SH LaTeX .IP \[bu] 2 .IP \[bu] 2 -\f[B]2+2=4\f[] +2 + 2 = 4 .IP \[bu] 2 -\f[B]x\ \\in\ y\f[] +\f[I]x\f[] ∈ \f[I]y\f[] .IP \[bu] 2 -\f[B]\\alpha\ \\wedge\ \\omega\f[] +α ∧ ω .IP \[bu] 2 -\f[B]223\f[] +223 .IP \[bu] 2 -\f[B]p\f[]-Tree +\f[I]p\f[]-Tree .IP \[bu] 2 Here's some display math: .RS -\f[B]\\frac{d}{dx}f(x)=\\lim_{h\\to\ 0}\\frac{f(x+h)-f(x)}{h}\f[] +$\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}$ .RE .IP \[bu] 2 -Here's one that has a line break in it: -\f[B]\\alpha\ +\ \\omega\ \\times\ x^2\f[]. +Here's one that has a line break in it: α + ω × \f[I]x\f[]^2^. .PP These shouldn't be math: .IP \[bu] 2 |