diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-03-18 06:45:56 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-03-18 06:45:56 +0000 |
commit | 56217f100404bc277c53518436ea93973c7705ac (patch) | |
tree | e41352966698134d6a7031f2b29e52ba16be1868 /data | |
parent | d704f47b86f49a46fab91969ae3fc92957cc8149 (diff) | |
download | pandoc-56217f100404bc277c53518436ea93973c7705ac.tar.gz |
Added --mathml option; removed Text.Pandoc.LaTeXMathML.
* Added data/MathMLinHTML.js, which is included when no URL is provided
for --mathml. This allows MathML to be displayed in better browsers,
as text/html.
* The module was no longer necessary; its functionality (two lines)
was incorporated into pandoc.hs.
* Consolidated the two LaTeXMathML.js files into one.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1909 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'data')
-rw-r--r-- | data/LaTeXMathML.js (renamed from data/LaTeXMathML.js.packed) | 9 | ||||
-rw-r--r-- | data/LaTeXMathML.js.comment | 16 | ||||
-rw-r--r-- | data/MathMLinHTML.js | 70 |
3 files changed, 78 insertions, 17 deletions
diff --git a/data/LaTeXMathML.js.packed b/data/LaTeXMathML.js index 472e26f91..4957624de 100644 --- a/data/LaTeXMathML.js.packed +++ b/data/LaTeXMathML.js @@ -1,4 +1,11 @@ - +/* +LaTeXMathML.js from http://math.etsu.edu/LaTeXMathML/ +Adapted by Jeff Knisely and Douglas Woodall from ASCIIMathML.js v. 1.4.7, +(c) 2005 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. +*/ var checkForMathML=true;var notifyIfNoMathML=true;var alertIfNoMathML=false;var mathcolor="";var mathfontfamily="";var showasciiformulaonhover=true;var isIE=document.createElementNS==null;if(document.getElementById==null) alert("This webpage requires a recent browser such as \nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer") function AMcreateElementXHTML(t){if(isIE)return document.createElement(t);else return document.createElementNS("http://www.w3.org/1999/xhtml",t);} diff --git a/data/LaTeXMathML.js.comment b/data/LaTeXMathML.js.comment deleted file mode 100644 index fc60b1f74..000000000 --- a/data/LaTeXMathML.js.comment +++ /dev/null @@ -1,16 +0,0 @@ -/* -LaTeXMathML.js from http://math.etsu.edu/LaTeXMathML/ -Adapted by Jeff Knisely and Douglas Woodall from ASCIIMathML.js v. 1.4.7, -(c) 2005 Peter Jipsen http://www.chapman.edu/~jipsen. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at -your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License (at http://www.gnu.org/copyleft/gpl.html) -for more details. -*/ diff --git a/data/MathMLinHTML.js b/data/MathMLinHTML.js new file mode 100644 index 000000000..ad718cf7e --- /dev/null +++ b/data/MathMLinHTML.js @@ -0,0 +1,70 @@ +/* +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].nodeValue); + 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; +} + +function convert() { + var mmlnode = document.getElementsByTagName("math"); + var st,str,node,newnode; + for (var i=0; i<mmlnode.length; i++) + if (document.createElementNS!=null) + mmlnode[i].parentNode.replaceChild(convertMath(mmlnode[i]),mmlnode[i]); + else { // convert for IE + str = ""; + node = mmlnode[i]; + while (node.nodeName!="/MATH") { + st = node.nodeName.toLowerCase(); + if (st=="#text") str += node.nodeValue; + else { + str += (st.slice(0,1)=="/" ? "</m:"+st.slice(1) : "<m:"+st); + if (st.slice(0,1)!="/") + for(var j=0; j < node.attributes.length; j++) + if (node.attributes[j].nodeValue!="italic" && + node.attributes[j].nodeValue!="" && + node.attributes[j].nodeValue!="inherit" && + node.attributes[j].nodeValue!=undefined) + str += " "+node.attributes[j].nodeName+"="+ + "\""+node.attributes[j].nodeValue+"\""; + str += ">"; + } + node = node.nextSibling; + node.parentNode.removeChild(node.previousSibling); + } + str += "</m:math>"; + newnode = document.createElement("span"); + node.parentNode.replaceChild(newnode,node); + newnode.innerHTML = str; + } +} + +if (document.createElementNS==null) { + document.write("<object id=\"mathplayer\"\ + classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>"); + document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>"); +} +if(typeof window.addEventListener != 'undefined'){ + window.addEventListener('load', convert, false); +} +if(typeof window.attachEvent != 'undefined') { + window.attachEvent('onload', convert); +} |