Hi all,
I was playing with convert Markdown + LaTeX to HTML + MathML with Pandoc.
I notice that the standalone HTML template used by Pandoc has a Javascript
function to convert MathML elements.
I ask at Pandoc list and John said that the Javascript was there for years. I
believe that we don't need it anymore but want to check with you.
Cheers,
Raniere
----- Forwarded message from Raniere Silva <
ran...@ime.unicamp.br> -----
Date: Tue, 16 Dec 2014 09:37:22 -0200
From: Raniere Silva <
ran...@ime.unicamp.br>
To:
pandoc-...@googlegroups.com
Subject: Javascript at standalone HTML + MathML
User-Agent: Mutt/1.5.23 (2014-03-12)
When I ran
$ cat sample.tex
foo $x$ bar
$ pandoc -v | head -n 1
pandoc 1.13.2
$ pandoc -s -f latex -t html --mathml sample.tex | head -n 33
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<script type="text/javascript">/*<![CDATA[*/
/*
March 19, 2004 MathHTML (c) Peter Jipsen
http://www.chapman.edu/~jipsen
Released under the GNU General Public License version 2 or later.
See the GNU General Public License (at
http://www.gnu.org/copyleft/gpl.html)
for more details.
*/
function convertMath(node) {// for Gecko
if (node.nodeType==1) {
var newnode =
document.createElementNS("
http://www.w3.org/1998/Math/MathML",
node.nodeName.toLowerCase());
for(var i=0; i < node.attributes.length; i++)
newnode.setAttribute(node.attributes[i].nodeName,
node.attributes[i].value);
for (var i=0; i<node.childNodes.length; i++) {
var st = node.childNodes[i].nodeValue;
if (st==null || st.slice(0,1)!=" " && st.slice(0,1)!="\n")
newnode.appendChild(convertMath(node.childNodes[i]));
}
return newnode;
}
else return node;
}
I notice the Javascript function convertMath for Firefox/Gecko. Wasn't clear to
me why we need this. Anyone can give me a explanation?
Thanks,
Raniere
----- End forwarded message -----