Fixed up LaTeXMathML module not to use TH.

Instead, we read the script in pandoc.hs, and pass it via variables.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1702 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2009-12-31 01:13:16 +00:00
parent b7750b705a
commit f36ce015c4
4 changed files with 19 additions and 7 deletions

View file

@ -6,11 +6,8 @@ import Text.Pandoc.Shared (readDataFile)
-- | String containing LaTeXMathML javascript. -- | String containing LaTeXMathML javascript.
latexMathMLScript :: IO String latexMathMLScript :: IO String
latexMathMLScript = undefined
{-
latexMathMLScript = do latexMathMLScript = do
jsCom <- readDataFile $ "data" </> "LaTeXMathML.js.comment" jsCom <- readDataFile $ "data" </> "LaTeXMathML.js.comment"
jsPacked <- readDataFile $ "data" </> "LaTeXMathML.js.packed" jsPacked <- readDataFile $ "data" </> "LaTeXMathML.js.packed"
return $ "<script type=\"text/javascript\">\n" ++ jsCom ++ jsPacked ++ return $ "<script type=\"text/javascript\">\n" ++ jsCom ++ jsPacked ++
"</script>\n" "</script>\n"
-}

View file

@ -34,6 +34,7 @@ import Text.Pandoc
import Text.Pandoc.ODT import Text.Pandoc.ODT
import Text.Pandoc.Writers.S5 (s5HeaderIncludes) import Text.Pandoc.Writers.S5 (s5HeaderIncludes)
import Text.Pandoc.Templates (getDefaultTemplate) import Text.Pandoc.Templates (getDefaultTemplate)
import Text.Pandoc.LaTeXMathML (latexMathMLScript)
import Text.Pandoc.Shared ( HTMLMathMethod (..), tabFilter, ObfuscationMethod (..) ) import Text.Pandoc.Shared ( HTMLMathMethod (..), tabFilter, ObfuscationMethod (..) )
#ifdef _HIGHLIGHTING #ifdef _HIGHLIGHTING
import Text.Pandoc.Highlighting ( languages ) import Text.Pandoc.Highlighting ( languages )
@ -261,8 +262,8 @@ options =
, Option "m" ["latexmathml", "asciimathml"] , Option "m" ["latexmathml", "asciimathml"]
(OptArg (OptArg
(\arg opt -> return opt { optHTMLMathMethod = (\arg opt ->
LaTeXMathML arg }) return opt { optHTMLMathMethod = LaTeXMathML arg })
"URL") "URL")
"" -- "Use LaTeXMathML script in html output" "" -- "Use LaTeXMathML script in html output"
@ -641,6 +642,12 @@ main = do
variables variables
else return variables else return variables
variables'' <- case mathMethod of
LaTeXMathML (Just _) -> do
s <- latexMathMLScript
return $ ("latexmathml-script", s) : variables'
_ -> return variables'
let startParserState = let startParserState =
defaultParserState { stateParseRaw = parseRaw, defaultParserState { stateParseRaw = parseRaw,
stateTabStop = tabStop, stateTabStop = tabStop,
@ -660,7 +667,7 @@ main = do
writerTemplate = if null template writerTemplate = if null template
then defaultTemplate then defaultTemplate
else template, else template,
writerVariables = variables', writerVariables = variables'',
writerIncludeBefore = concat befores, writerIncludeBefore = concat befores,
writerIncludeAfter = concat afters, writerIncludeAfter = concat afters,
writerTabStop = tabStop, writerTabStop = tabStop,

View file

@ -7,7 +7,13 @@
/><meta name="generator" content="pandoc" /><meta name="generator" content="pandoc"
/><meta name="author" content="$authors$" /><meta name="author" content="$authors$"
/><meta name="date" content="$date$" /><meta name="date" content="$date$"
/>$header-includes$ />
$if(latexmathml-script)$
$latexmathml-script$
$endif$
$if(header-includes)$
$header-includes$
$endif$
</head </head
><body ><body
> >

View file

@ -33,7 +33,9 @@ $if(numbersections)$
$else$ $else$
\setcounter{secnumdepth}{0} \setcounter{secnumdepth}{0}
$endif$ $endif$
$if(header-includes)$
$header-includes$ $header-includes$
$endif$
$if(title)$ $if(title)$
\title{$title$} \title{$title$}