git.iko.soy/typeable/pandoc
on master help sign in
Man writer: convert math to unicode when possible.

(As in other writers.)

commit4aaa1991fdf950e569b3a1565fc0e63a0261ae51 authorJohn MacFarlane <jgm@berkeley.edu> dateMon 26 Apr 2010, 23:04 (17 years ago) parentc243e5b
2 files changed+10−10
src/Text/Pandoc/Writers/Man.hs+3−2 tests/writer.man+7−8
src/Text/Pandoc/Writers/Man.hs+3−2
@@ -32,6 +32,7 @@ module Text.Pandoc.Writers.Man ( writeMan) where
3232import Text.Pandoc.Definition
3333import Text.Pandoc.Templates
3434import Text.Pandoc.Shared
35+import Text.Pandoc.Readers.TeXMath
3536import Text.Printf ( printf )
3637import Data.List ( isPrefixOf, intersperse, intercalate )
3738import Text.PrettyPrint.HughesPJ hiding ( Str )
@@ -301,9 +302,9 @@ inlineToMan _ Ellipses = return $ text "\\&..."
301302inlineToMan _ (Code str) =
302303 return $ text $ "\\f[B]" ++ escapeCode str ++ "\\f[]"
303304inlineToMan _ (Str str) = return $ text $ escapeString str
304−inlineToMan opts (Math InlineMath str) = inlineToMan opts (Code str)
305+inlineToMan opts (Math InlineMath str) = inlineListToMan opts $ readTeXMath str
305306inlineToMan opts (Math DisplayMath str) = do
306− contents <- inlineToMan opts (Code str)
307+ contents <- inlineListToMan opts $ readTeXMath str
307308 return $ text ".RS" $$ contents $$ text ".RE"
308309inlineToMan _ (TeX _) = return empty
309310inlineToMan _ (HtmlInline _) = return empty
tests/writer.man+7−8
@@ -544,23 +544,22 @@ Ellipses\&...and\&...and\&....
544544.SH LaTeX
545545.IP \[bu] 2
546546.IP \[bu] 2
547−\f[B]2+2=4\f[]
547+2 + 2 = 4
548548.IP \[bu] 2
549−\f[B]x\ \\in\ y\f[]
549+\f[I]x\f[] ∈ \f[I]y\f[]
550550.IP \[bu] 2
551−\f[B]\\alpha\ \\wedge\ \\omega\f[]
551+α ∧ ω
552552.IP \[bu] 2
553−\f[B]223\f[]
553+223
554554.IP \[bu] 2
555−\f[B]p\f[]-Tree
555+\f[I]p\f[]-Tree
556556.IP \[bu] 2
557557Here's some display math:
558558.RS
559−\f[B]\\frac{d}{dx}f(x)=\\lim_{h\\to\ 0}\\frac{f(x+h)-f(x)}{h}\f[]
559+$\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}$
560560.RE
561561.IP \[bu] 2
562−Here's one that has a line break in it:
563−\f[B]\\alpha\ +\ \\omega\ \\times\ x^2\f[].
562+Here's one that has a line break in it: α + ω × \f[I]x\f[]^2^.
564563.PP
565564These shouldn't be math:
566565.IP \[bu] 2