git.iko.soy/typeable/pandoc
on master help sign in
Renamed readTeXMath' to avoid name conflict with texmath 0.6.7

Also removed deprecated readTeXMath.

commite7d8039969fd177da91b871f3bc4b73950cc7bc8 authorMatthew Pickering <matthewtpickering@gmail.com> dateSat 19 Jul 2014, 18:10 (12 years ago) parentfe6b4e5
9 files changed+17−26
src/Text/Pandoc/Readers/TeXMath.hs+3−12 src/Text/Pandoc/Writers/Docbook.hs+2−2 src/Text/Pandoc/Writers/Docx.hs+1−1 src/Text/Pandoc/Writers/HTML.hs+2−2 src/Text/Pandoc/Writers/Haddock.hs+2−2 src/Text/Pandoc/Writers/Man.hs+2−2 src/Text/Pandoc/Writers/Markdown.hs+3−3 src/Text/Pandoc/Writers/OpenDocument.hs+1−1 src/Text/Pandoc/Writers/RTF.hs+1−1
src/Text/Pandoc/Readers/TeXMath.hs+3−12
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2727
2828Conversion of TeX math to a list of 'Pandoc' inline elements.
2929-}
30−module Text.Pandoc.Readers.TeXMath ( readTeXMath, readTeXMath' ) where
30+module Text.Pandoc.Readers.TeXMath ( texMathToInlines ) where
3131
3232import Text.Pandoc.Definition
3333import Text.TeXMath
@@ -35,22 +35,13 @@ import Text.TeXMath
3535-- | Converts a raw TeX math formula to a list of 'Pandoc' inlines.
3636-- Defaults to raw formula between @$@ or @$$@ characters if entire formula
3737-- can't be converted.
38−readTeXMath' :: MathType
38+texMathToInlines :: MathType
3939 -> String -- ^ String to parse (assumes @'\n'@ line endings)
4040 -> [Inline]
41−readTeXMath' mt inp = case texMathToPandoc dt inp of
41+texMathToInlines mt inp = case texMathToPandoc dt inp of
4242 Left _ -> [Str (delim ++ inp ++ delim)]
4343 Right res -> res
4444 where (dt, delim) = case mt of
4545 DisplayMath -> (DisplayBlock, "$$")
4646 InlineMath -> (DisplayInline, "$")
4747
48−{-# DEPRECATED readTeXMath "Use readTeXMath' from Text.Pandoc.JSON instead" #-}
49−-- | Converts a raw TeX math formula to a list of 'Pandoc' inlines.
50−-- Defaults to raw formula between @$@ characters if entire formula
51−-- can't be converted. (This is provided for backwards compatibility;
52−-- it is better to use @readTeXMath'@, which properly distinguishes
53−-- between display and inline math.)
54−readTeXMath :: String -- ^ String to parse (assumes @'\n'@ line endings)
55− -> [Inline]
56−readTeXMath = readTeXMath' InlineMath
src/Text/Pandoc/Writers/Docbook.hs+2−2
@@ -299,8 +299,8 @@ inlineToDocbook opts (Math t str)
299299 $ fixNS
300300 $ removeAttr r
301301 Left _ -> inlinesToDocbook opts
302− $ readTeXMath' t str
303− | otherwise = inlinesToDocbook opts $ readTeXMath' t str
302+ $ texMathToInlines t str
303+ | otherwise = inlinesToDocbook opts $ texMathToInlines t str
304304 where (dt, tagtype) = case t of
305305 InlineMath -> (DisplayInline,"inlineequation")
306306 DisplayMath -> (DisplayBlock,"informalequation")
src/Text/Pandoc/Writers/Docx.hs+1−1
@@ -756,7 +756,7 @@ inlineToOpenXML opts (Math mathType str) = do
756756 else DisplayInline
757757 case texMathToOMML displayType str of
758758 Right r -> return [r]
759− Left _ -> inlinesToOpenXML opts (readTeXMath' mathType str)
759+ Left _ -> inlinesToOpenXML opts (texMathToInlines mathType str)
760760inlineToOpenXML opts (Cite _ lst) = inlinesToOpenXML opts lst
761761inlineToOpenXML opts (Code attrs str) =
762762 withTextProp (rStyle "VerbatimChar")
src/Text/Pandoc/Writers/HTML.hs+2−2
@@ -704,14 +704,14 @@ inlineToHtml opts inline =
704704 Right r -> return $ preEscapedString $
705705 ppcElement conf r
706706 Left _ -> inlineListToHtml opts
707− (readTeXMath' t str) >>= return .
707+ (texMathToInlines t str) >>= return .
708708 (H.span ! A.class_ "math")
709709 MathJax _ -> return $ H.span ! A.class_ "math" $ toHtml $
710710 case t of
711711 InlineMath -> "\\(" ++ str ++ "\\)"
712712 DisplayMath -> "\\[" ++ str ++ "\\]"
713713 PlainMath -> do
714− x <- inlineListToHtml opts (readTeXMath' t str)
714+ x <- inlineListToHtml opts (texMathToInlines t str)
715715 let m = H.span ! A.class_ "math" $ x
716716 let brtag = if writerHtml5 opts then H5.br else H.br
717717 return $ case t of
src/Text/Pandoc/Writers/Haddock.hs+2−2
@@ -39,7 +39,7 @@ import Text.Pandoc.Options
3939import Data.List ( intersperse, transpose )
4040import Text.Pandoc.Pretty
4141import Control.Monad.State
42−import Text.Pandoc.Readers.TeXMath (readTeXMath')
42+import Text.Pandoc.Readers.TeXMath (texMathToInlines)
4343import Network.URI (isURI)
4444import Data.Default
4545
@@ -319,7 +319,7 @@ inlineToHaddock opts (Math mt str) = do
319319 let adjust x = case mt of
320320 DisplayMath -> cr <> x <> cr
321321 InlineMath -> x
322− adjust `fmap` (inlineListToHaddock opts $ readTeXMath' mt str)
322+ adjust `fmap` (inlineListToHaddock opts $ texMathToInlines mt str)
323323inlineToHaddock _ (RawInline f str)
324324 | f == "haddock" = return $ text str
325325 | otherwise = return empty
src/Text/Pandoc/Writers/Man.hs+2−2
@@ -331,9 +331,9 @@ inlineToMan _ (Code _ str) =
331331 return $ text $ "\\f[C]" ++ escapeCode str ++ "\\f[]"
332332inlineToMan _ (Str str) = return $ text $ escapeString str
333333inlineToMan opts (Math InlineMath str) =
334− inlineListToMan opts $ readTeXMath' InlineMath str
334+ inlineListToMan opts $ texMathToInlines InlineMath str
335335inlineToMan opts (Math DisplayMath str) = do
336− contents <- inlineListToMan opts $ readTeXMath' DisplayMath str
336+ contents <- inlineListToMan opts $ texMathToInlines DisplayMath str
337337 return $ cr <> text ".RS" $$ contents $$ text ".RE"
338338inlineToMan _ (RawInline f str)
339339 | f == Format "man" = return $ text str
src/Text/Pandoc/Writers/Markdown.hs+3−3
@@ -45,7 +45,7 @@ import Text.Pandoc.Pretty
4545import Control.Monad.State
4646import qualified Data.Set as Set
4747import Text.Pandoc.Writers.HTML (writeHtmlString)
48−import Text.Pandoc.Readers.TeXMath (readTeXMath')
48+import Text.Pandoc.Readers.TeXMath (texMathToInlines)
4949import Text.HTML.TagSoup (parseTags, isTagText, Tag(..))
5050import Network.URI (isURI)
5151import Data.Default
@@ -733,7 +733,7 @@ inlineToMarkdown opts (Math InlineMath str)
733733 return $ "\\(" <> text str <> "\\)"
734734 | isEnabled Ext_tex_math_double_backslash opts =
735735 return $ "\\\\(" <> text str <> "\\\\)"
736− | otherwise = inlineListToMarkdown opts $ readTeXMath' InlineMath str
736+ | otherwise = inlineListToMarkdown opts $ texMathToInlines InlineMath str
737737inlineToMarkdown opts (Math DisplayMath str)
738738 | isEnabled Ext_tex_math_dollars opts =
739739 return $ "$$" <> text str <> "$$"
@@ -742,7 +742,7 @@ inlineToMarkdown opts (Math DisplayMath str)
742742 | isEnabled Ext_tex_math_double_backslash opts =
743743 return $ "\\\\[" <> text str <> "\\\\]"
744744 | otherwise = (\x -> cr <> x <> cr) `fmap`
745− inlineListToMarkdown opts (readTeXMath' DisplayMath str)
745+ inlineListToMarkdown opts (texMathToInlines DisplayMath str)
746746inlineToMarkdown opts (RawInline f str)
747747 | f == "html" || f == "markdown" ||
748748 (isEnabled Ext_raw_tex opts && (f == "latex" || f == "tex")) =
src/Text/Pandoc/Writers/OpenDocument.hs+1−1
@@ -380,7 +380,7 @@ inlineToOpenDocument o ils
380380 | SmallCaps l <- ils = withTextStyle SmallC $ inlinesToOpenDocument o l
381381 | Quoted t l <- ils = inQuotes t <$> inlinesToOpenDocument o l
382382 | Code _ s <- ils = withTextStyle Pre $ inTextStyle $ preformatted s
383− | Math t s <- ils = inlinesToOpenDocument o (readTeXMath' t s)
383+ | Math t s <- ils = inlinesToOpenDocument o (texMathToInlines t s)
384384 | Cite _ l <- ils = inlinesToOpenDocument o l
385385 | RawInline f s <- ils = if f == Format "opendocument"
386386 then return $ text s
src/Text/Pandoc/Writers/RTF.hs+1−1
@@ -332,7 +332,7 @@ inlineToRTF (Quoted DoubleQuote lst) =
332332 "\\u8220\"" ++ (inlineListToRTF lst) ++ "\\u8221\""
333333inlineToRTF (Code _ str) = "{\\f1 " ++ (codeStringToRTF str) ++ "}"
334334inlineToRTF (Str str) = stringToRTF str
335−inlineToRTF (Math t str) = inlineListToRTF $ readTeXMath' t str
335+inlineToRTF (Math t str) = inlineListToRTF $ texMathToInlines t str
336336inlineToRTF (Cite _ lst) = inlineListToRTF lst
337337inlineToRTF (RawInline f str)
338338 | f == Format "rtf" = str