@@ -6,6 +6,7 @@ import Text.Pandoc.Definition
6import Text.Pandoc.Builder
6import Text.Pandoc.Builder
7import Text.XML.Light
7import Text.XML.Light
8import Text.Pandoc.Compat.TagSoupEntity (lookupEntity)
8import Text.Pandoc.Compat.TagSoupEntity (lookupEntity)
9+import Data.Either (rights)
9import Data.Generics
10import Data.Generics
10import Data.Monoid
11import Data.Monoid
11import Data.Char (isSpace)
12import Data.Char (isSpace)
@@ -13,6 +14,7 @@ import Control.Monad.State
13import Control.Applicative ((<$>))
14import Control.Applicative ((<$>))
14import Data.List (intersperse)
15import Data.List (intersperse)
15import Data.Maybe (fromMaybe)
16import Data.Maybe (fromMaybe)
17+import Text.TeXMath (readMathML, writeTeX)
@@ -126,7 +128,7 @@ List of all DocBook tags, with [x] indicating implemented,
126[ ] envar - A software environment variable
128[ ] envar - A software environment variable
127[x] epigraph - A short inscription at the beginning of a document or component
129[x] epigraph - A short inscription at the beginning of a document or component
128 note: also handle embedded attribution tag
130 note: also handle embedded attribution tag
129−[ ] equation - A displayed mathematical equation
131+[x] equation - A displayed mathematical equation
130[ ] errorcode - An error code
132[ ] errorcode - An error code
131[ ] errorname - An error name
133[ ] errorname - An error name
132[ ] errortext - An error message.
134[ ] errortext - An error message.
@@ -185,12 +187,12 @@ List of all DocBook tags, with [x] indicating implemented,
185[x] indexinfo - Meta-information for an Index
187[x] indexinfo - Meta-information for an Index
186[x] indexterm - A wrapper for terms to be indexed
188[x] indexterm - A wrapper for terms to be indexed
187[x] info - A wrapper for information about a component or other block. (DocBook v5)
189[x] info - A wrapper for information about a component or other block. (DocBook v5)
188−[ ] informalequation - A displayed mathematical equation without a title
190+[x] informalequation - A displayed mathematical equation without a title
189[ ] informalexample - A displayed example without a title
191[ ] informalexample - A displayed example without a title
190[ ] informalfigure - A untitled figure
192[ ] informalfigure - A untitled figure
191[ ] informaltable - A table without a title
193[ ] informaltable - A table without a title
192[ ] initializer - The initializer for a FieldSynopsis
194[ ] initializer - The initializer for a FieldSynopsis
193−[ ] inlineequation - A mathematical equation or expression occurring inline
195+[x] inlineequation - A mathematical equation or expression occurring inline
194[ ] inlinegraphic - An object containing or pointing to graphical data
196[ ] inlinegraphic - An object containing or pointing to graphical data
195 that will be rendered inline
197 that will be rendered inline
196[x] inlinemediaobject - An inline media object (video, audio, image, and so on)
198[x] inlinemediaobject - An inline media object (video, audio, image, and so on)
@@ -239,7 +241,7 @@ List of all DocBook tags, with [x] indicating implemented,
239[ ] methodname - The name of a method
241[ ] methodname - The name of a method
240[ ] methodparam - Parameters to a method
242[ ] methodparam - Parameters to a method
241[ ] methodsynopsis - A syntax summary for a method
243[ ] methodsynopsis - A syntax summary for a method
242−[ ] mml:math - A MathML equation
244+[x] mml:math - A MathML equation
243[ ] modespec - Application-specific information necessary for the
245[ ] modespec - Application-specific information necessary for the
244 completion of an OLink
246 completion of an OLink
245[ ] modifier - Modifiers in a synopsis
247[ ] modifier - Modifiers in a synopsis
@@ -882,6 +884,9 @@ parseInline (CRef ref) =
882 return $ maybe (text $ map toUpper ref) (text . (:[])) $ lookupEntity ref
884 return $ maybe (text $ map toUpper ref) (text . (:[])) $ lookupEntity ref
883parseInline (Elem e) =
885parseInline (Elem e) =
884 case qName (elName e) of
886 case qName (elName e) of
887+ "equation" -> equation displayMath
888+ "informalequation" -> equation displayMath
889+ "inlineequation" -> equation math
885 "subscript" -> subscript <$> innerInlines
890 "subscript" -> subscript <$> innerInlines
886 "superscript" -> superscript <$> innerInlines
891 "superscript" -> superscript <$> innerInlines
887 "inlinemediaobject" -> getImage e
892 "inlinemediaobject" -> getImage e
@@ -943,6 +948,13 @@ parseInline (Elem e) =
943 _ -> innerInlines
948 _ -> innerInlines
944 where innerInlines = (trimInlines . mconcat) <$>
949 where innerInlines = (trimInlines . mconcat) <$>
945 (mapM parseInline $ elContent e)
950 (mapM parseInline $ elContent e)
951+ equation constructor = return $ mconcat $
952+ map (constructor . writeTeX)
954+ $ map (readMathML . showElement . everywhere (mkT removePrefix))
955+ $ filterChildren (\x -> qName (elName x) == "math" &&
956+ qPrefix (elName x) == Just "mml") e
957+ removePrefix elname = elname { qPrefix = Nothing }
946 codeWithLang = do
958 codeWithLang = do
947 let classes' = case attrValue "language" e of
959 let classes' = case attrValue "language" e of