Pandoc: Javascript at standalone HTML + MathML

Raniere Silva <[email protected]> Fri, 19 Dec 2014 11:09:40 -0200
Newsgroups gmane.comp.mozilla.devel.mathml
Message-ID <[email protected]>
--===============5081455127141761115==
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="I9OoqgdbYjK0Ftbq"
Content-Disposition: inline


--I9OoqgdbYjK0Ftbq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 <[email protected]> -----

Date: Tue, 16 Dec 2014 09:37:22 -0200
=46rom: Raniere Silva <[email protected]>
To: [email protected]
Subject: Javascript at standalone HTML + MathML
User-Agent: Mutt/1.5.23 (2014-03-12)

When I ran
   =20
    $ cat sample.tex=20
    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=3D"http://www.w3.org/1999/xhtml">
    <head>
      <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf=
-8" />
      <meta http-equiv=3D"Content-Style-Type" content=3D"text/css" />
      <meta name=3D"generator" content=3D"pandoc" />
      <title></title>
      <style type=3D"text/css">code{white-space: pre;}</style>
      <script type=3D"text/javascript">/*<![CDATA[*/
      /*
      March 19, 2004 MathHTML (c) Peter Jipsen http://www.chapman.edu/~jips=
en
      Released under the GNU General Public License version 2 or later.
      See the GNU General Public License (at http://www.gnu.org/copyleft/gp=
l.html)
      for more details.
      */
     =20
      function convertMath(node) {// for Gecko
        if (node.nodeType=3D=3D1) {
          var newnode =3D
            document.createElementNS("http://www.w3.org/1998/Math/MathML",
              node.nodeName.toLowerCase());
          for(var i=3D0; i < node.attributes.length; i++)
            newnode.setAttribute(node.attributes[i].nodeName,
              node.attributes[i].value);
          for (var i=3D0; i<node.childNodes.length; i++) {
            var st =3D node.childNodes[i].nodeValue;
            if (st=3D=3Dnull || st.slice(0,1)!=3D" " && st.slice(0,1)!=3D"\=
n")
              newnode.appendChild(convertMath(node.childNodes[i]));
          }
          return newnode;
        }
        else return node;
      }

I notice the Javascript function convertMath for Firefox/Gecko. Wasn't clea=
r to
me why we need this. Anyone can give me a explanation?

Thanks,
Raniere



----- End forwarded message -----

--I9OoqgdbYjK0Ftbq
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJUlCOUAAoJEHvMcvpUpXXNLzMP/3tFWpmi5Wrac7IC2/7nmLl9
RaYwNfq7/RotiXPBdOGeChIwGMDcrPDCrl4anljuxowxGdIVsT+YMMxtFEcnLCIN
2homoJ/L6SZg9uu49u/SGRRuCBDGeXoNPMDBm1ERwUenWSHDnMlbBbHt+pAPZiLL
Ycf30+JkqyRPTdTZ6kOxEj8PIMLDmZ4y12xXVLDuL/KXdQVzUNCUl//5kuk4sk7i
bcaFusad14Bph5YRA/qDIst4VWyxuRUDG2Uzrn/gb4b6vNzapADRQu6QR2KS4p2m
5nynlYgiLoNfZYZip0/7946h3E2NhGXHCdlHTL4v30KeRvlofqqILcmh6xHLUEj4
ptM80/qZz3Gt5yyz57UPI+uw3WRrmJVWx6dNGOODP00IuWmjoqGucUY2qw2hnVzN
lCtd1rLTxeTxtzMu2jvyTSUKbtWduLJZqUQP2S7//68Nj9DmY9Q5qnCktdHMeAtp
GOISSTO3uYuRnSf3YDF+1oA9Q0esfltTjnT6JTzQXJBYviA03Vm0/hC+x1wFudPV
tgCa62WnKEx0TW8w8a2zvLVVnnvZKGKm3mW0P+R4g+1VmnpI2cJhBswQCymh8Ia/
uImw5BxdIjWsJAg7CU4n2E5pTGy00XfwEf+YDmMIHQtuLiu5cjydHbARmGJYdsK4
4R9UiLfw89fAHIS8K3Mx
=KnkL
-----END PGP SIGNATURE-----

--I9OoqgdbYjK0Ftbq--

--===============5081455127141761115==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
dev-tech-mathml mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-mathml

--===============5081455127141761115==--