@@ -8,9 +8,38 @@
88 /><meta name="author" content="Sam Smith"
99 /><meta name="author" content="Jen Jones"
1010 /><meta name="date" content="July 15, 2006"
11− /><script type="text/javascript">
12−/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
13−See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
11+ /><script type="text/javascript"
12+ >/*
13+ASCIIMathML.js
14+==============
15+This file contains JavaScript functions to convert ASCII math notation
16+to Presentation MathML. The conversion is done while the (X)HTML page
17+loads, and should work with Firefox/Mozilla/Netscape 7+ and Internet
18+Explorer 6+MathPlayer (http://www.dessci.com/en/products/mathplayer/).
19+Just add the next line to your (X)HTML page with this file in the same folder:
20+<script type="text/javascript" src="ASCIIMathML.js"></script>
21+This is a convenient and inexpensive solution for authoring MathML.
22+
23+Version 1.4.7 Dec 15, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen
24+Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js
25+For changes see http://www.chapman.edu/~jipsen/mathml/asciimathchanges.txt
26+If you use it on a webpage, please send the URL to jipsen@chapman.edu
27+
28+Modified July 2006 by John MacFarlane (added CODE to list of contexts
29+in which replacement does not occur, modified AMisMathMLAvailable
30+to better identify Safari browser, changed mathcolor to "").
31+
32+This program is free software; you can redistribute it and/or modify
33+it under the terms of the GNU General Public License as published by
34+the Free Software Foundation; either version 2 of the License, or (at
35+your option) any later version.
36+
37+This program is distributed in the hope that it will be useful,
38+but WITHOUT ANY WARRANTY; without even the implied warranty of
39+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
40+General Public License (at http://www.gnu.org/copyleft/gpl.html)
41+for more details.
42+*/
1443
1544var checkForMathML = true; // check if browser can display MathML
1645var notifyIfNoMathML = true; // display note if no MathML capability
@@ -59,8 +88,7 @@ function AMnoMathMLNote() {
5988}
6089
6190function AMisMathMLavailable() {
62− var regex = /KHTML/; /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
63−See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
91+ var regex = /KHTML/; /* This line and the next two modified by JM for better Safari detection */
6492 if (navigator.appName.slice(0,8)=="Netscape")
6593 if (navigator.appVersion.slice(0,1)>="5" && !regex.test(navigator.userAgent)) return null;
6694 else return AMnoMathMLNote();
@@ -443,8 +471,16 @@ function AMremoveBrackets(node) {
443471 }
444472}
445473
446−/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
447−See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
474+/*Parsing ASCII math expressions with the following grammar
475+v ::= [A-Za-z] | greek letters | numbers | other constant symbols
476+u ::= sqrt | text | bb | other unary symbols for font commands
477+b ::= frac | root | stackrel binary symbols
478+l ::= ( | [ | { | (: | {: left brackets
479+r ::= ) | ] | } | :) | :} right brackets
480+S ::= v | lEr | uS | bSS Simple expression
481+I ::= S_S | S^S | S_S^S | S Intermediate expression
482+E ::= IE | I/I Expression
483+Each terminal symbol is translated into a corresponding mathml node.*/
448484
449485var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol;
450486
@@ -783,8 +819,7 @@ function AMprocessNodeR(n, linebreaks) {
783819 if ((n.nodeType!=8 || linebreaks) &&
784820 n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" &&
785821 n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" &&
786− n.parentNode.nodeName!="code" && n.parentNode.nodeName!="CODE" && /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
787−See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
822+ n.parentNode.nodeName!="code" && n.parentNode.nodeName!="CODE" && /* added by JM */
788823 n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE") {
789824 str = n.nodeValue;
790825 if (!(str == null)) {
@@ -919,8 +954,8 @@ else
919954 window.onload = generic;
920955 }
921956}
922−</script>
923−<!-- configuration parameters -->
957+</script
958+ ><!-- configuration parameters -->
924959<meta name="defaultView" content="slideshow" />
925960<meta name="controlVis" content="hidden" />
926961<style type="text/css" media="projection" id="slideProj">