diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-03-18 06:45:56 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-03-18 06:45:56 +0000 |
commit | 56217f100404bc277c53518436ea93973c7705ac (patch) | |
tree | e41352966698134d6a7031f2b29e52ba16be1868 /src/Text/Pandoc/Writers | |
parent | d704f47b86f49a46fab91969ae3fc92957cc8149 (diff) | |
download | pandoc-56217f100404bc277c53518436ea93973c7705ac.tar.gz |
Added --mathml option; removed Text.Pandoc.LaTeXMathML.
* Added data/MathMLinHTML.js, which is included when no URL is provided
for --mathml. This allows MathML to be displayed in better browsers,
as text/html.
* The module was no longer necessary; its functionality (two lines)
was incorporated into pandoc.hs.
* Consolidated the two LaTeXMathML.js files into one.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1909 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 020edea65..ddffa471b 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -42,6 +42,8 @@ import Data.List ( isPrefixOf, intersperse ) import Data.Maybe ( catMaybes ) import Control.Monad.State import Text.XHtml.Transitional hiding ( stringToHtml ) +import Text.TeXMath +import Text.XML.Light.Output data WriterState = WriterState { stNotes :: [Html] -- ^ List of notes @@ -111,17 +113,20 @@ pandocToHtml opts (Pandoc (Meta title' authors' date') blocks) = do LaTeXMathML (Just url) -> script ! [src url, thetype "text/javascript"] $ noHtml + MathML (Just url) -> + script ! + [src url, thetype "text/javascript"] $ noHtml JsMath (Just url) -> script ! [src url, thetype "text/javascript"] $ noHtml - _ -> case lookup "latexmathml-script" (writerVariables opts) of + _ -> case lookup "mathml-script" (writerVariables opts) of Just s -> script ! [thetype "text/javascript"] << primHtml s Nothing -> noHtml else noHtml let newvars = [("highlighting","yes") | stHighlighting st] ++ - [("math", renderHtmlFragment math) | stMath st] + [("math", renderHtmlFragment math) | stMath st] return (tit, auths, date, toc, thebody, newvars) inTemplate :: TemplateTarget a @@ -450,6 +455,17 @@ inlineToHtml opts inline = alt str, title str] GladTeX -> return $ primHtml $ "<EQ>" ++ str ++ "</EQ>" + MathML _ -> do + let dt = if t == InlineMath + then DisplayInline + else DisplayBlock + let conf = useShortEmptyTags (const False) + defaultConfigPP + case texMathToMathML dt str of + Right r -> return $ primHtml $ + ppcElement conf r + Left _ -> inlineToHtml opts + (Math t str) PlainMath -> inlineListToHtml opts (readTeXMath str) >>= return . (thespan ! [theclass "math"]) ) |