diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-12-01 03:11:52 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-12-01 03:11:52 +0000 |
commit | ef028fee59869997995895f1869d415f66311b8b (patch) | |
tree | 944fd4c118d3c71da0667c2027fdda6120459cd3 | |
parent | 6e079a67e89ff9fef9ffbe01489fb7950c0b9f5f (diff) | |
download | pandoc-ef028fee59869997995895f1869d415f66311b8b.tar.gz |
Added --gladtex and --mimetex options.
+ New HTMLMathMethod structure in WriterOptions keeps track of how to
display math in HTML output.
+ If none of the special options are selected, default to displaying
TeX math verbatim, with no enclosing $'s, in HTML.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1125 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r-- | Main.hs | 30 | ||||
-rw-r--r-- | Text/Pandoc/Writers/HTML.hs | 6 |
2 files changed, 22 insertions, 14 deletions
@@ -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 -> |