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
This commit is contained in:
parent
096413b2f3
commit
4f28d47b90
5 changed files with 46 additions and 10 deletions
6
Main.hs
6
Main.hs
|
@ -257,6 +257,12 @@ options =
|
|||
"URL")
|
||||
"" -- "Use mimetex for HTML math"
|
||||
|
||||
, Option "" ["jsmath"]
|
||||
(OptArg
|
||||
(\arg opt -> return opt { optHTMLMathMethod = JsMath arg})
|
||||
"URL")
|
||||
"" -- "Use jsMath for HTML math"
|
||||
|
||||
, Option "" ["gladtex"]
|
||||
(NoArg
|
||||
(\opt -> return opt { optHTMLMathMethod = GladTeX }))
|
||||
|
|
36
README
36
README
|
@ -328,19 +328,28 @@ For further documentation, see the `pandoc(1)` man page.
|
|||
no *url* is provided, the contents of the script will be inserted
|
||||
directly; this provides portability at the price of efficiency. If
|
||||
you plan to use math on several pages, it is much better to link to
|
||||
a copy of `LaTeXMathML.js`, which can be cached. (See `--gladtex`
|
||||
and `--mimetex` for alternative ways of dealing with math in HTML.)
|
||||
a copy of `LaTeXMathML.js`, which can be cached. (See `--jsmath`,
|
||||
`--gladtex`, and `--mimetex` for alternative ways of dealing with
|
||||
math in HTML.)
|
||||
|
||||
`--jsmath`*=[url]*
|
||||
: causes `pandoc` to use the [jsMath] script to display
|
||||
TeX math in HTML or S5. The *url* should point to the jsMath load
|
||||
script (e.g. `jsMath/easy/load.js`). If it is provided, a link to it
|
||||
will be included in the header of standalone HTML documents.
|
||||
(See `--latexmathml`, `--mimetex`, and `--gladtex` for alternative
|
||||
ways of dealing with math in HTML.)
|
||||
|
||||
`--gladtex`*[=url]*
|
||||
: causes TeX formulas to be enclosed in `<eq>` tags in HTML or S5 output.
|
||||
This output can then be processed by [gladTeX] to produce links to
|
||||
images with the typeset formulas. (See `--latexmathml` and
|
||||
images with the typeset formulas. (See `--latexmathml`, `--jsmath`, and
|
||||
`--mimetex` for alternative ways of dealing with math in HTML.)
|
||||
|
||||
`--mimetex`*[=url]*
|
||||
: causes TeX formulas to be replaced by `<img>` tags linking to the
|
||||
[mimeTeX] CGI script, which will produce images with the typeset
|
||||
formulas. (See `--latexmathml` and `--gladtex` for alternative
|
||||
formulas. (See `--latexmathml`, `--jsmath`, and `--gladtex` for alternative
|
||||
ways of dealing with math in HTML.)
|
||||
|
||||
`-i` or `--incremental`
|
||||
|
@ -397,6 +406,7 @@ For further documentation, see the `pandoc(1)` man page.
|
|||
|
||||
[Smartypants]: http://daringfireball.net/projects/smartypants/
|
||||
[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/
|
||||
[jsMath]: http://www.math.union.edu/~dpvc/jsmath/
|
||||
[gladTeX]: http://www.math.uio.no/~martingu/gladtex/index.html
|
||||
[mimeTeX]: http://www.forkosh.com/mimetex.html
|
||||
|
||||
|
@ -924,18 +934,24 @@ command-line options selected:
|
|||
styled differently from the surrounding text if needed.
|
||||
|
||||
2. If the `--latexmathml` option is used, TeX math will be displayed
|
||||
between $ characters, as in LaTeX, and the [LaTeXMathML] script will
|
||||
be used to render it as formulas. (This trick does not work in all
|
||||
browsers, but it works in Firefox. In browsers that do not support
|
||||
LaTeXMathML, TeX math will appear verbatim between $ characters.)
|
||||
between $ or $$ characters and put in `<span>` tags with class `LaTeX`.
|
||||
The [LaTeXMathML] script will be used to render it as formulas.
|
||||
(This trick does not work in all browsers, but it works in Firefox.
|
||||
In browsers that do not support LaTeXMathML, TeX math will appear
|
||||
verbatim between $ characters.)
|
||||
|
||||
3. If the `--mimetex` option is used, the [mimeTeX] CGI script will
|
||||
3. If the `--jsmath` option is used, TeX math will be put inside
|
||||
`<span>` tags (for inline math) or `<div>` tags (for display math)
|
||||
with class `math`. The [jsMath] script will be used to render
|
||||
it.
|
||||
|
||||
4. If the `--mimetex` option is used, the [mimeTeX] CGI script will
|
||||
be called to generate images for each TeX formula. This should
|
||||
work in all browsers. The `--mimetex` option takes an optional URL
|
||||
as argument. If no URL is specified, it will be assumed that the
|
||||
mimeTeX CGI script is at `/cgi-bin/mimetex.cgi`.
|
||||
|
||||
4. If the `--gladtex` option is used, TeX formulas will be enclosed
|
||||
5. If the `--gladtex` option is used, TeX formulas will be enclosed
|
||||
in `<eq>` tags in the HTML output. The resulting `htex` file may then
|
||||
be processed by [gladTeX], which will produce image files for each
|
||||
formula and an `html` file with links to these images. So, the
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -112,6 +112,11 @@ to Pandoc. Or use `html2markdown`(1), a wrapper around `pandoc`.
|
|||
provide a *URL*. If no *URL* is provided, the contents of the
|
||||
script will be inserted directly into the HTML header.
|
||||
|
||||
\--jsmath=*URL*
|
||||
: Use jsMath to display embedded TeX math in HTML output.
|
||||
The *URL* should point to the jsMath load script; if provided,
|
||||
it will be linked to in the header of standalone HTML documents.
|
||||
|
||||
\--gladtex
|
||||
: Enclose TeX math in `<eq>` tags in HTML output. These can then
|
||||
be processed by gladTeX to produce links to images of the typeset
|
||||
|
|
Loading…
Add table
Reference in a new issue