ASCIIMathML.js (ver 1.4) download page (HTML version)

ASCIIMathML.js is freely available under the GNU General Public License. The current version is 1.4 (what's new).

It is very easy to use ASCIIMathML.js on your own webpages. If you use it on a webpage, please put a link to www.chapman.edu/~jipsen/asciimath.html on that webpage and send me an email at jipsen@chapman.edu with the URL so that I can add a link on the users page. (Also send me an email if you have problems or would like to provide some feedback.)

Here is the script: ASCIIMathML.js (right-click on the link and choose "Save Target As..." if your browser does not display the JavaScript code). The script, a copy of this page, and sample .html and .xml files are zipped (or tared) at asciimathml-1.4 on SourceForge.net Logo

To write your own HTML file that uses ASCIIMathML.js, save your file with the standard .html extension and use the following lines at the top of your file:

<html xmlns:mml="http://www.w3.org/1998/Math/MathML">
<head>
<object id="mathplayer" classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987">
</object><?import namespace="mml" implementation="#mathplayer"?>
<script type="text/javascript" src="ASCIIMathML.js"></script>
<title>your title...</title>
</head>
<body onload="translate()">

Note that ASCIIMathML.js should be in the same folder as your HTML file (alternatively include the full path to ASCIIMathML in the 5th line above).

That's it!

Here is a sample file that you can save and modify to suit your local needs. Right-click on the file and use Save Target As... to save this file (if you choose Save As ... while viewing the file, IE does not save the correct header information). Check that the HTML file is viewable by IE+MathPlayer and by Netscape7 (or equivalent).

Note that usually Netscape7/Mozilla/Firefox do not display MathML in HTML files (only in XHTML files), but with ASCIIMathML they do!

Here is some information on how to extend ASCIIMathML.js with additional symbols (this method may be preferable to editing the file ASCIIMathML.js).


Peter Jipsen, Chapman University, April 2004 Valid HTML 4.01!

'Afghanistan', 'AL' => 'Albania', 'DZ' => 'Algeria', 'AS' => 'American Samoa', 'AD' => 'Andorra', 'AO' => 'Angola', 'AI' => 'Anguilla', 'AQ' => 'Antarctica', 'AG' => 'Antigua and Barbuda', 'AR' => 'Argentina', 'AM' => 'Armenia', 'AW' => 'Aruba', 'AU' => 'Australia', 'AT' => 'Austria', 'AZ' => 'Azerbaijan', 'BS' => 'Bahamas', 'BH' => 'Bahrain', 'BD' => 'Bangladesh', 'BB' => 'Barbados', 'BY' => 'Belarus', 'BE' => 'Belgium', 'BZ' => 'Belize', 'BJ' => 'Benin', 'BM' => 'Bermuda', 'BT' => 'Bhutan', 'BO' => 'Bolivia', 'BA' => 'Bosnia and Herzegovina', 'BW' => 'Botswana', 'BV' => 'Bouvet Island', 'BR' => 'Brazil', 'IO' => 'Chagos Archipelago', 'VG' => 'British Virgin Islands', 'BN' => 'Brunei Darussalam', 'BG' => 'Bulgaria', 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'KH' => 'Cambodia', 'CM' => 'Cameroon', 'CA' => 'Canada', 'CV' => 'Cape Verde', 'KY' => 'Cayman Islands', 'CF' => 'Central African Republic', 'TD' => 'Chad', 'CL' => 'Chile', 'CN' => 'China', 'CX' => 'Christmas Island', 'CC' => 'Cocos Islands', 'CO' => 'Colombia', 'KM' => 'Comoros', 'CD' => 'Congo', 'CG' => 'Congo', 'CK' => 'Cook Islands', 'CR' => 'Costa Rica', 'CI' => 'Cote D\'Ivoire', 'CU' => 'Cuba', 'CY' => 'Cyprus', 'CZ' => 'Czech Republic', 'DK' => 'Denmark', 'DJ' => 'Djibouti', 'DM' => 'Dominica', 'DO' => 'Dominican Republic', 'TL' => 'Timor-Leste', 'EC' => 'Ecuador', 'EG' => 'Egypt', 'SV' => 'El Salvador', 'GQ' => 'Equatorial Guinea', 'ER' => 'Eritrea', 'EE' => 'Estonia', 'ET' => 'Ethiopia', 'FO' => 'Faeroe Islands', 'FK' => 'Falkland Islands', 'FJ' => 'Fiji', 'FI' => 'Finland', 'FR' => 'France', 'GF' => 'French Guiana', 'PF' => 'French Polynesia', 'TF' => 'French Southern Territories', 'GA' => 'Gabon', 'GM' => 'Gambia', 'GE' => 'Georgia', 'DE' => 'Germany', 'GH' => 'Ghana', 'GI' => 'Gibraltar', 'GR' => 'Greece', 'GL' => 'Greenland', 'GD' => 'Grenada', 'GP' => 'Guadaloupe', 'GU' => 'Guam', 'GT' => 'Guatemala', 'GN' => 'Guinea', 'GW' => 'Guinea-Bissau', 'GY' => 'Guyana', 'HT' => 'Haiti', 'HM' => 'Heard and McDonald Islands', 'VA' => 'Vatican City State', 'HN' => 'Honduras', 'HK' => 'Hong Kong', 'HR' => 'Croatia', 'HU' => 'Hungary', 'IS' => 'Iceland', 'IN' => 'India', 'ID' => 'Indonesia', 'IR' => 'Iran', 'IQ' => 'Iraq', 'IE' => 'Ireland', 'IL' => 'Israel', 'IT' => 'Italy', 'JM' => 'Jamaica', 'JP' => 'Japan', 'JO' => 'Jordan', 'KZ' => 'Kazakhstan', 'KE' => 'Kenya', 'KI' => 'Kiribati', 'KP' => 'Korea', 'KR' => 'Korea', 'KW' => 'Kuwait', 'KG' => 'Kyrgyz Republic', 'LA' => 'Lao People\'s Democratic Republic', 'LV' => 'Latvia', 'LB' => 'Lebanon', 'LS' => 'Lesotho', 'LR' => 'Liberia', 'LY' => 'Libyan Arab Jamahiriya', 'LI' => 'Liechtenstein', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'MO' => 'Macao', 'MK' => 'Macedonia', 'MG' => 'Madagascar', 'MW' => 'Malawi', 'MY' => 'Malaysia', 'MV' => 'Maldives', 'ML' => 'Mali', 'MT' => 'Malta', 'MH' => 'Marshall Islands', 'MQ' => 'Martinique', 'MR' => 'Mauritania', 'MU' => 'Mauritius', 'YT' => 'Mayotte', 'MX' => 'Mexico', 'FM' => 'Micronesia', 'MD' => 'Moldova', 'MC' => 'Monaco', 'MN' => 'Mongolia', 'MS' => 'Montserrat', 'MA' => 'Morocco', 'MZ' => 'Mozambique', 'MM' => 'Myanmar', 'NA' => 'Namibia', 'NR' => 'Nauru', 'NP' => 'Nepal', 'AN' => 'Netherlands Antilles', 'NL' => 'Netherlands', 'NC' => 'New Caledonia', 'NZ' => 'New Zealand', 'NI' => 'Nicaragua', 'NE' => 'Niger', 'NG' => 'Nigeria', 'NU' => 'Niue', 'NF' => 'Norfolk Island', 'MP' => 'Northern Mariana Islands', 'NO' => 'Norway', 'OM' => 'Oman', 'PK' => 'Pakistan', 'PW' => 'Palau', 'PS' => 'Palestinian Territory', 'PA' => 'Panama', 'PG' => 'Papua New Guinea', 'PY' => 'Paraguay', 'PE' => 'Peru', 'PH' => 'Philippines', 'PN' => 'Pitcairn Island', 'PL' => 'Poland', 'PT' => 'Portugal', 'PR' => 'Puerto Rico', 'QA' => 'Qatar', 'RE' => 'Reunion', 'RO' => 'Romania', 'RU' => 'Russian Federation', 'RW' => 'Rwanda', 'SH' => 'St. Helena', 'KN' => 'St. Kitts and Nevis', 'LC' => 'St. Lucia', 'PM' => 'St. Pierre and Miquelon', 'VC' => 'St. Vincent and the Grenadines', 'WS' => 'Samoa', 'SM' => 'San Marino', 'ST' => 'Sao Tome and Principe', 'SA' => 'Saudi Arabia', 'SN' => 'Senegal', 'SC' => 'Seychelles', 'SL' => 'Sierra Leone', 'SG' => 'Singapore', 'SK' => 'Slovakia', 'SI' => 'Slovenia', 'SB' => 'Solomon Islands', 'SO' => 'Somalia', 'ZA' => 'South Africa', 'GS' => 'South Georgia and the South Sandwich Islands', 'ES' => 'Spain', 'LK' => 'Sri Lanka', 'SD' => 'Sudan', 'SR' => 'Suriname', 'SJ' => 'Svalbard & Jan Mayen Islands', 'SZ' => 'Swaziland', 'SE' => 'Sweden', 'CH' => 'Switzerland', 'SY' => 'Syrian Arab Republic', 'TW' => 'Taiwan', 'TJ' => 'Tajikistan', 'TZ' => 'Tanzania', 'TH' => 'Thailand', 'TG' => 'Togo', 'TK' => 'Tokelau', 'TO' => 'Tonga', 'TT' => 'Trinidad and Tobago', 'TN' => 'Tunisia', 'TR' => 'Turkey', 'TM' => 'Turkmenistan', 'TC' => 'Turks and Caicos Islands', 'TV' => 'Tuvalu', 'VI' => 'US Virgin Islands', 'UG' => 'Uganda', 'UA' => 'Ukraine', 'AE' => 'United Arab Emirates', 'GB' => 'UK', 'UK' => 'UK', 'UM' => 'United States Minor Outlying Islands', 'US' => 'USA', 'UY' => 'Uruguay', 'UZ' => 'Uzbekistan', 'VU' => 'Vanuatu', 'VE' => 'Venezuela', 'VN' => 'Viet Nam', 'WF' => 'Wallis and Futuna Islands', 'EH' => 'Western Sahara', 'YE' => 'Yemen', 'YU' => 'Yugoslavia', 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe', '**' => 'Unknown' ); $iplines = file('../php/ip-to-country.txt'); $num_iplines = count($iplines); function iptocountry($ip) { global $countryCodeName, $iplines, $num_iplines; $numbers = preg_split("/\./", $ip); $code = $numbers[0]*16777216+$numbers[1]*65536+$numbers[2]*256+$numbers[3]; $n = -1; $h = $num_iplines; while ($n+1<$h) { $m = ($n+$h) >> 1; if (substr($iplines[$m],0,-2)<$code) {$n = $m;} else {$h = $m;} } $cn = $countryCodeName[substr($iplines[$h-1],-3,2)]; // if ($cn == '') {echo $code.' ';} return $cn; } $lines = file('asciimathdownloadcounter.txt'); $num_lines = count($lines); $countries = array(); $ipaddr = array(); $last =array(); $visits = 0; for ($i = 0; $i < $num_lines; $i++) { $ipn = explode(" ",$lines[$i]); if (!isset($ipaddr[$ipn[0]])) { $ipaddr[$ipn[0]]=1; $visits++; $c = iptocountry($ipn[0]); if (isset($countries[$c])) {$countries[$c]++;} else {$countries[$c]=1;} if ($i >= $num_lines-10) { $last[] = $c; } } else { if ($i >= $num_lines-10) { $last[] = iptocountry($ipn[0]); } } } ksort($countries); echo "
$hits visits from ".(count($countries)-2)." countries (since Jan 10, 2004)
"; foreach ($countries as $key=>$val) if ($key!=Unknown && $key!="Hong Kong") {echo $key.", ";} echo "
Countries of most recent visitors: ".implode(" ",$last); echo "
"; ?>