aboutsummaryrefslogtreecommitdiff
path: root/Text
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-10-28 21:54:50 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-10-28 21:54:50 +0000
commit4f28d47b90d8dde0de21d5db966520959ead8684 (patch)
treea1843bd43bb38fd5465edad41c86e33efe785b2c /Text
parent096413b2f35a8386eeecebcabbf04f0cde580857 (diff)
downloadpandoc-4f28d47b90d8dde0de21d5db966520959ead8684.tar.gz
Added --jsmath option.
- Added --jsmath option to Main.hs - Added JsMath to HTMLMathMethod in Text.Pandoc.Shared. - Handle math appropriately in HTML writer when JsMath selected. - Documented the option in README and man page. Resolves Issue #68. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1472 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Text')
-rw-r--r--Text/Pandoc/Shared.hs1
-rw-r--r--Text/Pandoc/Writers/HTML.hs8
2 files changed, 9 insertions, 0 deletions
diff --git a/Text/Pandoc/Shared.hs b/Text/Pandoc/Shared.hs
index 30fd3fc07..8b08a0e94 100644
--- a/Text/Pandoc/Shared.hs
+++ b/Text/Pandoc/Shared.hs
@@ -870,6 +870,7 @@ isHeaderBlock _ = False
data HTMLMathMethod = PlainMath
| LaTeXMathML (Maybe String) -- url of LaTeXMathML.js
+ | JsMath (Maybe String) -- url of jsMath load script
| GladTeX
| MimeTeX String -- url of mimetex.cgi
deriving (Show, Read, Eq)
diff --git a/Text/Pandoc/Writers/HTML.hs b/Text/Pandoc/Writers/HTML.hs
index 628e784ed..8dafd2440 100644
--- a/Text/Pandoc/Writers/HTML.hs
+++ b/Text/Pandoc/Writers/HTML.hs
@@ -129,6 +129,10 @@ writeHtml opts (Pandoc (Meta tit authors date) blocks) =
script !
[src url, thetype "text/javascript"] $
noHtml
+ JsMath (Just url) ->
+ script !
+ [src url, thetype "text/javascript"] $
+ noHtml
_ -> noHtml
else noHtml
head' = header $ metadata +++ math +++ css +++
@@ -467,6 +471,10 @@ inlineToHtml opts inline =
if t == InlineMath
then primHtml ("$" ++ str ++ "$")
else primHtml ("$$" ++ str ++ "$$")
+ JsMath _ ->
+ return $ if t == InlineMath
+ then thespan ! [theclass "math"] $ primHtml str
+ else thediv ! [theclass "math"] $ primHtml str
MimeTeX url ->
return $ image ! [src (url ++ "?" ++ str),
alt str, title str]