File: mathmltest

package info (click to toggle)
maxima-sage 5.45.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 113,788 kB
  • sloc: lisp: 440,833; fortran: 14,665; perl: 14,369; tcl: 10,997; sh: 4,475; makefile: 2,520; ansic: 447; python: 262; xml: 59; awk: 37; sed: 17
file content (68 lines) | stat: -rwxr-xr-x 2,064 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh

if [ $# -lt 1 ]; then
  echo "Need to pass in names of Maxima test files to use"
  exit 1
fi

# First, build up the Maxima batch file
rm -f mathmltest.mac
for i in $@
do
  # The following is easy but does not cope with multiline test output
  # sed 's/.*\$$/tmp:%;mathml(tmp,"mathmltest.xml");tmp;/' $i >> mathmltest.mac

  echo "/* $i */" >> mathmltest.mac
  awk '{line[count]=$0; count++;}
       /; *$/ {lastsemicolonline=NR; 
               for (i=0; i < count; i++) print line[i];
               delete line;
               count=0;}
       /\$ *$/ {lastdollarline=NR; 
                count=0;
                print "tmp:%;mathml(tmp,\"mathmltest.xml\");tmp;"}' $i >> mathmltest.mac
done

# Now run Maxima over the test file, to produce mathmltest.xml
rm -f mathmltest.xml mathmltest_ie.xml
../maxima-local -b mathmltest.mac

# Now insert some paragraph breaks
sed 's/<pre>/<p\/><pre>/' mathmltest.xml > tmp$$
sed 's/<math/<p\/><math/' tmp$$ > mathmltest.xml
rm tmp$$

# Put in XHTML epilog
echo "</body>
</html>" >> mathmltest.xml

# Make into XHTML for IE 
echo "<?xml version=\"1.0\"?>
<?xml-stylesheet type=\"text/xsl\" href=\"pmathml.xsl\"?>
<!DOCTYPE html 
[
  <!ENTITY mathml \"http://www.w3.org/1998/Math/MathML\">" >> mathmltest_ie.xml
cat mathml_ref_list >> mathmltest_ie.xml
echo "]>  
<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">
<head>
<title>Maxima MathML Output Test Page</title>
</head>
<body>" >> mathmltest_ie.xml
cat mathmltest.xml >> mathmltest_ie.xml

# Make into XHTML for normal browsers
echo "<?xml version=\"1.0\"?>
<?xml-stylesheet type=\"text/xsl\" href=\"pmathml.xsl\"?>
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN\"
               \"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd\"
[
  <!ENTITY mathml \"http://www.w3.org/1998/Math/MathML\">
]>  
<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">
<head>
<title>Maxima MathML Output Test Page</title>
</head>
<body>" > tmp$$.xml
cat mathmltest.xml >> tmp$$.xml
mv tmp$$.xml mathmltest.xml