aboutsummaryrefslogtreecommitdiff
path: root/src/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2010-07-15 19:01:00 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2010-07-15 19:01:00 -0700
commit57a91f3b6add303ef70aa29a14a8c67123ec7c0f (patch)
tree3ec6a5f9dcb5e0c9d88d84d2599a68ee5b82a279 /src/pandoc.hs
parent8757da76b0e4c26f722ac4742689739b2b5dfb08 (diff)
downloadpandoc-57a91f3b6add303ef70aa29a14a8c67123ec7c0f.tar.gz
Added --webtex option for HTML math.
+ Added --webtex command-line option, with optional parameter. (Defaults to using google charts API.) + Added WebTeX HTMLMathMethod. + Removed MimeTeX HTMLMathMethod. (WebTeX is generic and subsumes it.) + Modified --mimetex option to use WebTeX. + Thanks to lpeterse for the idea and some of the code.
Diffstat (limited to 'src/pandoc.hs')
-rw-r--r--src/pandoc.hs18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs
index 38db4c6df..9546d6026 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -40,7 +40,6 @@ import System.Environment ( getArgs, getProgName, getEnvironment )
import System.Exit ( exitWith, ExitCode (..) )
import System.FilePath
import System.Console.GetOpt
-import Data.Maybe ( fromMaybe )
import Data.Char ( toLower, isDigit )
import Data.List ( intercalate, isSuffixOf )
import System.Directory ( getAppUserDataDirectory )
@@ -282,11 +281,24 @@ options =
, Option "" ["mimetex"]
(OptArg
- (\arg opt -> return opt { optHTMLMathMethod = MimeTeX
- (fromMaybe "/cgi-bin/mimetex.cgi" arg)})
+ (\arg opt -> do
+ let url = case arg of
+ Just u -> u ++ "?"
+ Nothing -> "/cgi-bin/mimetex.cgi?"
+ return opt { optHTMLMathMethod = WebTeX url })
"URL")
"" -- "Use mimetex for HTML math"
+ , Option "" ["webtex"]
+ (OptArg
+ (\arg opt -> do
+ let url = case arg of
+ Just u -> u
+ Nothing -> "http://chart.apis.google.com/chart?cht=tx&chl="
+ return opt { optHTMLMathMethod = WebTeX url })
+ "URL")
+ "" -- "Use web service for HTML math"
+
, Option "" ["jsmath"]
(OptArg
(\arg opt -> return opt { optHTMLMathMethod = JsMath arg})