aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Main.hs30
-rw-r--r--Text/Pandoc/Writers/HTML.hs6
2 files changed, 22 insertions, 14 deletions
diff --git a/Main.hs b/Main.hs
index afb5b701e..4d3e13b7f 100644
--- a/Main.hs
+++ b/Main.hs
@@ -98,8 +98,7 @@ data Opt = Opt
, optNumberSections :: Bool -- ^ Number sections in LaTeX
, optIncremental :: Bool -- ^ Use incremental lists in S5
, optSmart :: Bool -- ^ Use smart typography
- , optUseASCIIMathML :: Bool -- ^ Use ASCIIMathML
- , optASCIIMathMLURL :: Maybe String -- ^ URL to ASCIIMathML.js
+ , optHTMLMathMethod :: HTMLMathMethod -- ^ Method to print HTML math
, optDumpArgs :: Bool -- ^ Output command-line arguments
, optIgnoreArgs :: Bool -- ^ Ignore command-line arguments
, optStrict :: Bool -- ^ Use strict markdown syntax
@@ -127,8 +126,7 @@ defaultOpts = Opt
, optNumberSections = False
, optIncremental = False
, optSmart = False
- , optUseASCIIMathML = False
- , optASCIIMathMLURL = Nothing
+ , optHTMLMathMethod = PlainMath
, optDumpArgs = False
, optIgnoreArgs = False
, optStrict = False
@@ -196,12 +194,23 @@ options =
, Option "m" ["asciimathml"]
(OptArg
- (\arg opt -> return opt { optUseASCIIMathML = True,
- optASCIIMathMLURL = arg,
- optStandalone = True })
+ (\arg opt -> return opt { optHTMLMathMethod =
+ ASCIIMathML arg })
"URL")
"" -- "Use ASCIIMathML script in html output"
+ , Option "" ["mimetex"]
+ (OptArg
+ (\arg opt -> return opt { optHTMLMathMethod = MimeTeX
+ (fromMaybe "/cgi-bin/mimetex.cgi" arg)})
+ "URL")
+ "" -- "Use mimetex for HTML math"
+
+ , Option "" ["gladtex"]
+ (NoArg
+ (\opt -> return opt { optHTMLMathMethod = GladTeX }))
+ "" -- "Use gladtex for HTML math"
+
, Option "i" ["incremental"]
(NoArg
(\opt -> return opt { optIncremental = True }))
@@ -406,8 +415,7 @@ main = do
, optNumberSections = numberSections
, optIncremental = incremental
, optSmart = smart
- , optUseASCIIMathML = useASCIIMathML
- , optASCIIMathMLURL = asciiMathMLURL
+ , optHTMLMathMethod = mathMethod
, optDumpArgs = dumpArgs
, optIgnoreArgs = ignoreArgs
, optStrict = strict
@@ -450,10 +458,6 @@ main = do
Just cols -> read cols
Nothing -> stateColumns defaultParserState
- let mathMethod = if useASCIIMathML
- then ASCIIMathML asciiMathMLURL
- else PlainMath
-
let tabFilter _ [] = ""
tabFilter _ ('\n':xs) = '\n':(tabFilter tabStop xs)
-- remove DOS line endings
diff --git a/Text/Pandoc/Writers/HTML.hs b/Text/Pandoc/Writers/HTML.hs
index 0085e5419..881e3c07c 100644
--- a/Text/Pandoc/Writers/HTML.hs
+++ b/Text/Pandoc/Writers/HTML.hs
@@ -404,9 +404,13 @@ inlineToHtml opts inline =
(return $ case writerHTMLMathMethod opts of
ASCIIMathML _ ->
stringToHtml ("$" ++ str ++ "$")
+ MimeTeX url ->
+ image ! [src (url ++ "?" ++ str),
+ alt str, title str]
GladTeX ->
tag "eq" << str
- _ -> stringToHtml ("$" ++ str ++ "$"))
+ PlainMath ->
+ stringToHtml str)
(TeX str) -> return noHtml
(HtmlInline str) -> return $ primHtml str
(Link [Code str] (src,tit)) | "mailto:" `isPrefixOf` src ->