rdoc-f95 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +79 -0
  3. data/PostInstall.txt +7 -0
  4. data/README.rdoc +147 -0
  5. data/Rakefile +28 -0
  6. data/bin/rdoc-f95 +70 -0
  7. data/lib/rdoc-f95.rb +306 -0
  8. data/lib/rdoc-f95/code_objects.rb +776 -0
  9. data/lib/rdoc-f95/diagram.rb +342 -0
  10. data/lib/rdoc-f95/dot.rb +249 -0
  11. data/lib/rdoc-f95/generator.rb +1088 -0
  12. data/lib/rdoc-f95/generator/chm.rb +113 -0
  13. data/lib/rdoc-f95/generator/chm/chm.rb +98 -0
  14. data/lib/rdoc-f95/generator/html.rb +370 -0
  15. data/lib/rdoc-f95/generator/html/hefss.rb +414 -0
  16. data/lib/rdoc-f95/generator/html/html.rb +708 -0
  17. data/lib/rdoc-f95/generator/html/kilmer.rb +418 -0
  18. data/lib/rdoc-f95/generator/html/one_page_html.rb +121 -0
  19. data/lib/rdoc-f95/generator/ri.rb +229 -0
  20. data/lib/rdoc-f95/generator/xhtml.rb +106 -0
  21. data/lib/rdoc-f95/generator/xhtml/ctop.xsl +1318 -0
  22. data/lib/rdoc-f95/generator/xhtml/mathml.xsl +42 -0
  23. data/lib/rdoc-f95/generator/xhtml/pmathml.xsl +612 -0
  24. data/lib/rdoc-f95/generator/xhtml/pmathmlcss.xsl +872 -0
  25. data/lib/rdoc-f95/generator/xhtml/xhtml.rb +732 -0
  26. data/lib/rdoc-f95/generator/xml.rb +120 -0
  27. data/lib/rdoc-f95/generator/xml/rdf.rb +113 -0
  28. data/lib/rdoc-f95/generator/xml/xml.rb +111 -0
  29. data/lib/rdoc-f95/install.rb +166 -0
  30. data/lib/rdoc-f95/markup.rb +506 -0
  31. data/lib/rdoc-f95/markup/formatter.rb +14 -0
  32. data/lib/rdoc-f95/markup/fragments.rb +337 -0
  33. data/lib/rdoc-f95/markup/inline.rb +361 -0
  34. data/lib/rdoc-f95/markup/install.rb +57 -0
  35. data/lib/rdoc-f95/markup/lines.rb +152 -0
  36. data/lib/rdoc-f95/markup/mathml_wrapper.rb +91 -0
  37. data/lib/rdoc-f95/markup/preprocess.rb +71 -0
  38. data/lib/rdoc-f95/markup/sample/rdoc2latex.rb +16 -0
  39. data/lib/rdoc-f95/markup/sample/sample.rb +42 -0
  40. data/lib/rdoc-f95/markup/to_flow.rb +185 -0
  41. data/lib/rdoc-f95/markup/to_html.rb +357 -0
  42. data/lib/rdoc-f95/markup/to_html_crossref.rb +123 -0
  43. data/lib/rdoc-f95/markup/to_latex.rb +328 -0
  44. data/lib/rdoc-f95/markup/to_test.rb +50 -0
  45. data/lib/rdoc-f95/markup/to_xhtml_texparser.rb +234 -0
  46. data/lib/rdoc-f95/options.rb +745 -0
  47. data/lib/rdoc-f95/parsers/parse_c.rb +775 -0
  48. data/lib/rdoc-f95/parsers/parse_f95.rb +2499 -0
  49. data/lib/rdoc-f95/parsers/parse_rb.rb +2587 -0
  50. data/lib/rdoc-f95/parsers/parse_simple.rb +39 -0
  51. data/lib/rdoc-f95/parsers/parserfactory.rb +99 -0
  52. data/lib/rdoc-f95/ri.rb +2 -0
  53. data/lib/rdoc-f95/ri/cache.rb +188 -0
  54. data/lib/rdoc-f95/ri/descriptions.rb +147 -0
  55. data/lib/rdoc-f95/ri/display.rb +244 -0
  56. data/lib/rdoc-f95/ri/driver.rb +435 -0
  57. data/lib/rdoc-f95/ri/formatter.rb +603 -0
  58. data/lib/rdoc-f95/ri/paths.rb +105 -0
  59. data/lib/rdoc-f95/ri/reader.rb +106 -0
  60. data/lib/rdoc-f95/ri/util.rb +81 -0
  61. data/lib/rdoc-f95/ri/writer.rb +64 -0
  62. data/lib/rdoc-f95/stats.rb +23 -0
  63. data/lib/rdoc-f95/template.rb +64 -0
  64. data/lib/rdoc-f95/tokenstream.rb +33 -0
  65. data/lib/rdoc-f95/usage.rb +210 -0
  66. data/script/console +10 -0
  67. data/script/destroy +14 -0
  68. data/script/generate +14 -0
  69. data/test/test_helper.rb +3 -0
  70. data/test/test_rdoc-f95.rb +11 -0
  71. metadata +156 -0
@@ -0,0 +1,872 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!--
3
+ Presentation MathML Stylesheet
4
+ -->
5
+
6
+ <!--
7
+ $Id: pmathmlcss.xsl,v 1.1 2008-03-08 16:14:54 morikawa Exp $
8
+
9
+ Copyright David Carlisle 2001, 2002.
10
+
11
+ Use and distribution of this code are permitted under the terms of the <a
12
+ href="http://www.w3.org/Consortium/Legal/copyright-software-19980720"
13
+ >W3C Software Notice and License</a>.
14
+ -->
15
+
16
+ <xsl:stylesheet
17
+ version="1.0"
18
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
19
+ xmlns:h="http://www.w3.org/1999/xhtml"
20
+ xmlns:m="http://www.w3.org/1998/Math/MathML"
21
+ xmlns:doc="http://www.dcarlisle.demon.co.uk/xsldoc"
22
+ xmlns:x="data:,x"
23
+ exclude-result-prefixes="x h doc"
24
+ >
25
+
26
+ <h:h2>Dictionary</h:h2>
27
+
28
+ <h:p> The following elements in the x: namespace form an
29
+ implementation of an "Operator Dictionary" for this MathML
30
+ Implementation. In the case of stretch operators, the element
31
+ specifies the symbol parts via the latin-1 equivalent character based
32
+ on the encoding in the symbol font. It is a clear "failure to comply
33
+ to the spec" that using latin 1 characters (or numeric character
34
+ references) in the latin 1 range access glyphs in teh symbol font via
35
+ font position, however most of these character parts are not in
36
+ Unicode (until 3.2), so there is no standard way to access these characters.</h:p>
37
+
38
+ <x:x x="{" m="0em" stretch="true" top="�" middle="�" extend="�" bottom="�">{</x:x>
39
+ <x:x x="}" m="0em" stretch="true" top="�" middle="�" extend="�" bottom="�">{</x:x>
40
+
41
+ <x:x x="(" m="0em" stretch="true" top="�" middle="�" extend="�" bottom="�">(</x:x>
42
+ <x:x x=")" m="0em" stretch="true" top="�" middle="�" extend="�" bottom="�">)</x:x>
43
+
44
+ <x:x x="[" m="0em" stretch="true" top="�" middle="�" extend="�" bottom="�">[</x:x>
45
+ <x:x x="]" m="0em" stretch="true" top="�" middle="�" extend="�" bottom="�">]</x:x>
46
+
47
+ <x:x x="&#x301A;" m="0em" stretch="true" top="��" middle="��" extend="��" bottom="��">[[</x:x>
48
+ <x:x x="&#x301B;" m="0em" stretch="true" top="��" middle="��" extend="��" bottom="��">]]</x:x>
49
+
50
+ <x:x x="|" m="0em" stretch="true" top="�" middle="�" extend="�" bottom="�">|</x:x>
51
+ <x:x x="||" m="0em" stretch="true" top="��" middle="��" extend="��" bottom="��">||</x:x>
52
+
53
+ <x:x x="&#x2061;" m="0em">&#xFEFF;</x:x><!-- applyfunction -->
54
+ <x:x x="&#x2062;" m="0em">&#xFEFF;</x:x><!-- invisibletimes -->
55
+ <x:x x="-">&#x2212;</x:x>
56
+ <x:x x="&#x2243;"><span style="position:
57
+ relative; top: +.1em;">&#x2212;</span>&#xFEFF;<span style="position:
58
+ relative; left: -.55em; top: -.2em; margin: 0em;">~</span></x:x>
59
+ <x:x x="&#xFE38;" m="0em">_v_</x:x>
60
+
61
+
62
+ <h:p>Remove these for now, as XML parser in IE6 is broken and doesn't
63
+ accept plane 1 characters.</h:p>
64
+ <!--
65
+ <x:x x="&#x1D538;" v="doublestruck">A</x:x>
66
+ <x:x x="&#x1D539;" v="doublestruck">B</x:x>
67
+ <x:x x="&#x2102;" v="doublestruck">C</x:x>
68
+ <x:x x="&#x1D53B;" v="doublestruck">D</x:x>
69
+
70
+ <x:x x="&#x1D552;" v="doublestruck">a</x:x>
71
+ <x:x x="&#x1D553;" v="doublestruck">b</x:x>
72
+ <x:x x="&#x1D554;" v="doublestruck">c</x:x>
73
+ <x:x x="&#x1D555;" v="doublestruck">d</x:x>
74
+
75
+ <x:x x="&#x1D504;" v="fraktur">A</x:x>
76
+ <x:x x="&#x1D505;" v="fraktur">B</x:x>
77
+ <x:x x="&#x212D;" v="fraktur">C</x:x>
78
+ <x:x x="&#x1D507;" v="fraktur">D</x:x>
79
+
80
+ <x:x x="&#x1D51E;" v="fraktur">a</x:x>
81
+ <x:x x="&#x1D51F;" v="fraktur">b</x:x>
82
+ <x:x x="&#x1D520;" v="fraktur">c</x:x>
83
+ <x:x x="&#x1D521;" v="fraktur">d</x:x>
84
+ -->
85
+
86
+ <h:p>Grab all of the above into a variable.</h:p>
87
+ <xsl:variable name="opdict" select="document('')/*/x:x"/>
88
+
89
+ <h:h2>HTML elements</h:h2>
90
+
91
+ <h:p>
92
+ XHTML elements get passed straight through, sans namespace prefix.
93
+ </h:p>
94
+ <xsl:template match="h:*">
95
+ <xsl:element name="{local-name(.)}">
96
+ <xsl:copy-of select="@*"/>
97
+ <xsl:apply-templates/>
98
+ </xsl:element>
99
+ </xsl:template>
100
+
101
+
102
+
103
+
104
+ <h:p>
105
+ Template for the head element copies the original content, aand in
106
+ addition adds a script element and CSS style element that implement
107
+ the core of the MathML renderer.
108
+ </h:p>
109
+
110
+ <h:p doc:ref="malign">
111
+ The malign function first finds the left most item in the aligngroup, and
112
+ then modifies the left margin of each item to make them
113
+ align. (Currently only left alignment is supported.)
114
+ </h:p>
115
+
116
+ <h:p doc:ref="mrowStretch">
117
+ The mrowStretch function implements stretchy brackets. It is called
118
+ repeatedly, once for each mo child,after a span corresponding to an
119
+ mrow. The arguments are the id of teh span and the characters to use
120
+ for the parts of the stretch operator.
121
+ constructed fence. The
122
+ </h:p>
123
+
124
+ <h:p doc:ref="css">
125
+ Inline CSS style block handles all font and size specification for the
126
+ various MathML operators.
127
+ </h:p>
128
+
129
+ <xsl:template match="h:head">
130
+
131
+ <xsl:element name="{local-name(.)}">
132
+ <xsl:copy-of select="@*"/>
133
+ <xsl:apply-templates/>
134
+
135
+ <script>
136
+
137
+ <xsl:text doc:id="malign">
138
+ function malign (l)
139
+ {
140
+ var m = 0;
141
+ for ( i = 0; i &lt; l.length ; i++)
142
+ {
143
+ m = Math.max(m,l[i].offsetLeft);
144
+ }
145
+ for ( i = 0; i &lt; l.length ; i++)
146
+ {
147
+ l[i].style.marginLeft=m - l[i].offsetLeft;
148
+ }
149
+ }
150
+ </xsl:text>
151
+
152
+ <xsl:text doc:id="mrowStretch">
153
+ function mrowStretch (opid,opt,ope,opm,opb){
154
+ opH = opid.offsetHeight;
155
+ var opH;
156
+ var i;
157
+ var es;
158
+ if (mrowH &gt; opH * 2) {
159
+ m= "&lt;font size='+1' face='symbol'>" + opm + "&lt;/font>&lt;br/>" ;
160
+ if ((mrowH &lt; opH * 3) &amp;&amp;(opm == ope) ) m="";
161
+ es="";
162
+ for ( i = 3; i &lt;= mrowH / (2*opH) ; i += 1) es += "&lt;font size='+1' face='symbol'>" + ope + "&lt;/font>&lt;br/>" ;
163
+ opid.innerHTML="&lt;table class='lr'>&lt;tr>&lt;td>&lt;font size='+1' face='symbol'>" +
164
+ opt + "&lt;/font>&lt;br/>" +
165
+ es +
166
+ m +
167
+ es +
168
+ "&lt;font size='+1' face='symbol'>" + opb + "&lt;/font>&lt;/td>&lt;/tr>&lt;/table>";
169
+ }
170
+ }
171
+ </xsl:text>
172
+
173
+ <xsl:text doc:id="msubsup">
174
+ function msubsup (bs,bbs,x,b,p){
175
+ <!--
176
+ p.style.setExpression("top",bs +" .offsetTop - " + (p.offsetHeight/2 +(bbs.offsetHeight - Math.max(bbs.offsetHeight, b.offsetHeight + p.offsetHeight)*.5)));
177
+ -->
178
+ p.style.setExpression("top",bs +" .offsetTop -" + (p.offsetHeight/2));
179
+ b.style.setExpression("top",bs + ".offsetTop + " + (bbs.offsetHeight - b.offsetHeight*.5));
180
+ x.style.setExpression("marginLeft",Math.max(p.offsetWidth,b.offsetWidth));
181
+ document.recalc(true);
182
+ }
183
+ </xsl:text>
184
+
185
+ <!--
186
+ function msubsupzz (bs,x,b,p){
187
+ p.style.setExpression("top",bs +" .offsetTop - " + bs +
188
+ "p.offsetHeight/2 +(" + bs + ".offsetHeight - Math.max(" + bs + ".offsetHeight, (" + bs + "b.offsetHeight + " + bs + "p.offsetHeight)*.5))");
189
+ b.style.setExpression("top",bs + ".offsetTop + " + bs + ".offsetHeight - " + bs + "b.offsetHeight/2");
190
+ x.style.setExpression("marginLeft","Math.max(" + bs +"p.offsetWidth,"
191
+ + bs +"b.offsetWidth)");
192
+ }
193
+ -->
194
+
195
+ <xsl:text doc:id="msup">
196
+ function msup (bs,x,p){
197
+ p.style.setExpression("top",bs +" .offsetTop -" + (p.offsetHeight/2));
198
+ x.style.setExpression("marginLeft", bs +"p.offsetWidth");
199
+ x.style.setExpression("height", bs + ".offsetHeight + " + p.offsetHeight);
200
+ document.recalc(true);
201
+ }
202
+ </xsl:text>
203
+
204
+ <xsl:text doc:id="msub">
205
+ function msub (bs,x,p){
206
+ p.style.setExpression("top",bs +" .offsetTop +" + (p.offsetHeight/2));
207
+ x.style.setExpression("marginLeft", bs +"p.offsetWidth");
208
+ x.style.setExpression("height", bs + ".offsetHeight + " + p.offsetHeight);
209
+ document.recalc(true);
210
+ }
211
+ </xsl:text>
212
+
213
+ <xsl:text doc:id="toggle">
214
+ function toggle (x) {
215
+ for ( i = 0 ; i &lt; x.childNodes.length ; i++) {
216
+ if (x.childNodes.item(i).style.display=='inline') {
217
+ x.childNodes.item(i).style.display='none';
218
+ if ( i+1 == x.childNodes.length) {
219
+ x.childNodes.item(0).style.display='inline';
220
+ } else {
221
+ x.childNodes.item(i+1).style.display='inline';
222
+ };
223
+ break;
224
+ }
225
+ }
226
+ }
227
+ </xsl:text>
228
+ </script>
229
+
230
+
231
+ <style>
232
+ <xsl:text doc:id="css">
233
+
234
+ .msubsup {
235
+ <!--background-color: red;-->
236
+ font-size: 80%;
237
+ position: absolute;
238
+ }
239
+
240
+ .munderover {
241
+ display: inline;
242
+ vertical-align: middle;
243
+ }
244
+
245
+ .lr {
246
+ display: inline;
247
+ vertical-align: middle;
248
+ }
249
+
250
+ .mi {
251
+ font-style: serif;
252
+ }
253
+
254
+
255
+ .mspace{
256
+ display: inline;
257
+ }
258
+ .mtext {
259
+ font-style: serif;
260
+ }
261
+ .ms {
262
+ font-style: monospace;
263
+ }
264
+
265
+ .mi1 {
266
+ font-style: italic;
267
+ }
268
+
269
+ .doublestruck {
270
+ font-family: castellar, algerian,niagara engraved;
271
+ }
272
+ .mo {
273
+ padding-right: .3em;
274
+ padding-left: .3em;
275
+ }
276
+
277
+ .mn {
278
+ }
279
+
280
+ .msqrt {
281
+ border-style: solid;
282
+ border-color: black;
283
+ border-width: .1em 0pt 0pt .1em;
284
+ padding-left: .2em;
285
+ margin-left: 0em;
286
+ margin-top: .2em;
287
+ display: inline;
288
+ }
289
+
290
+ .actuarial {
291
+ border-style: solid;
292
+ border-color: black;
293
+ border-width: .1em .1em 0pt 0pt ;
294
+ padding-right: .2em;
295
+ margin-right: 0em;
296
+ margin-top: .2em;
297
+ display: inline;
298
+ }
299
+
300
+ .ssa {
301
+ position:relative; top:+0.5ex;
302
+ width: 0pt;
303
+ color: red;
304
+ }
305
+
306
+
307
+ .mover {
308
+ margin: 0pt;
309
+ padding: 0pt;
310
+ display: inline;
311
+ vertical-align: middle;
312
+ text-align: center;
313
+ }
314
+
315
+ .mtable {
316
+ display: inline;
317
+ vertical-align: middle;
318
+ }
319
+
320
+
321
+ .mfrac {
322
+ text-align: center;
323
+ display:inline;
324
+ vertical-align: middle;
325
+ }
326
+
327
+ .mfraca {
328
+ vertical-align: bottom;
329
+ }
330
+
331
+ .mfracaa {
332
+ border-width: 0em 0em .2ex 0em ; border-style: solid;
333
+ border-color: black;
334
+ }
335
+
336
+
337
+ .mfracb {
338
+ vertical-align: top;
339
+ }
340
+
341
+ .merror{
342
+ background-color: white ;
343
+ border-style: solid;
344
+ border-color: #FF0000;
345
+ color: #FF0000;
346
+ }
347
+ .mphantom{
348
+ visibility: hidden;
349
+ }
350
+ </xsl:text>
351
+ </style>
352
+ </xsl:element>
353
+ </xsl:template>
354
+
355
+ <h:p>
356
+ Unimplemented MathML elements get copied literally, in red, mainly as
357
+ a debugging aid.
358
+ </h:p>
359
+ <xsl:template match="m:*">
360
+ <span style="color: red;">&lt;<xsl:value-of select="local-name(.)"/>&gt;</span>
361
+ <xsl:apply-templates/>
362
+ <span style="color: red;">&lt;/<xsl:value-of select="local-name(.)"/>&gt;</span>
363
+ </xsl:template>
364
+
365
+ <h:p>
366
+ mi: set default font based on string length, otherwise behaviour based
367
+ on entries in the operator dictionary if one exists, or content is
368
+ copied through to the output unchanged.
369
+ </h:p>
370
+ <xsl:template match="m:mi">
371
+ <span class="mi">
372
+ <xsl:if test="1=string-length(normalize-space(.))">
373
+ <xsl:attribute name="class">mi1</xsl:attribute>
374
+ </xsl:if>
375
+ <xsl:apply-templates select="@mathvariant"/>
376
+ <xsl:variable name="x" select="normalize-space(.)"/>
377
+ <xsl:choose>
378
+ <xsl:when test="$opdict[@x=$x and @v]">
379
+ <xsl:attribute name="class"><xsl:value-of select="$opdict[@x=$x]/@v"/></xsl:attribute>
380
+ <xsl:value-of select="$opdict[@x=$x and @v]"/>
381
+ </xsl:when>
382
+ <xsl:otherwise>
383
+ <xsl:value-of select="$x"/>
384
+ </xsl:otherwise>
385
+ </xsl:choose>
386
+ </span>
387
+ </xsl:template>
388
+
389
+ <h:p>
390
+ Handling of mathvariant attribute.
391
+ The choice of font families here (currently) avoids math-specific
392
+ fonts but does use several fionts coming with windows 9.x and/or
393
+ office 2000.
394
+ </h:p>
395
+ <xsl:template match="@mathvariant[.='bold']">
396
+ <xsl:attribute name="style">font-weight: bold; font-style: upright</xsl:attribute>
397
+ </xsl:template>
398
+ <xsl:template match="@mathvariant[.='bold-italic']">
399
+ <xsl:attribute name="style">font-style: upright; font-weight: bold; font-style: italic;</xsl:attribute>
400
+ </xsl:template>
401
+ <xsl:template match="@mathvariant[.='italic']">
402
+ <xsl:attribute name="style">font-style: italic; </xsl:attribute>
403
+ </xsl:template>
404
+ <xsl:template match="@mathvariant[.='monospace']">
405
+ <xsl:attribute name="style">font-family: monospace; </xsl:attribute>
406
+ </xsl:template>
407
+
408
+ <xsl:template match="@mathvariant[.='sans-serif']">
409
+ <xsl:attribute name="style">font-family: sans-serif; </xsl:attribute>
410
+ </xsl:template>
411
+ <xsl:template match="@mathvariant[.='bold-sans-serif']">
412
+ <xsl:attribute name="style">font-family: sans-serif; font-weight: bold; </xsl:attribute>
413
+ </xsl:template>
414
+
415
+ <xsl:template match="@mathvariant[.='fraktur']">
416
+ <xsl:attribute name="style">font-family: old english text mt</xsl:attribute>
417
+ <xsl:attribute name="class"></xsl:attribute>
418
+ </xsl:template>
419
+
420
+ <xsl:template match="@mathvariant[.='double-struck']">
421
+ <xsl:attribute name="class">doublestruck</xsl:attribute>
422
+ </xsl:template>
423
+
424
+
425
+ <xsl:template match="@mathvariant[.='script']">
426
+ <xsl:attribute name="style">font-family: brush script mt italic</xsl:attribute>
427
+ <xsl:attribute name="class"></xsl:attribute>
428
+ </xsl:template>
429
+
430
+
431
+ <h:p>mo: Generate a unique ID so that a script at the end of any
432
+ surrounding mrow may replace the conent by a suitably stretched
433
+ operator if need be.</h:p>
434
+ <xsl:template match="m:mo">
435
+ <span id="{generate-id()}" class="mo">
436
+ <xsl:apply-templates/>
437
+ </span>
438
+ </xsl:template>
439
+
440
+ <h:p>mn: a simple span</h:p>
441
+ <xsl:template match="m:mn">
442
+ <span class="mn">
443
+ <xsl:apply-templates/>
444
+ </span>
445
+ </xsl:template>
446
+
447
+ <h:p>munder: currently only supports underline, with a bottom border</h:p>
448
+ <xsl:template match="m:munder">
449
+ <span class="munder">
450
+ <xsl:if test="normalize-space(*[2])='&#x332;'">
451
+ <xsl:attribute
452
+ name="style">border-width: 0pt 0pt .1em 0pt; border-style: solid;"</xsl:attribute>
453
+ </xsl:if>
454
+ <span><xsl:apply-templates select="*[1]"/></span>
455
+ </span>
456
+ </xsl:template>
457
+
458
+ <h:p>mover: currently only supports overline, with a top border</h:p>
459
+ <xsl:template match="m:mover">
460
+ <span class="munder">
461
+ <xsl:if test="normalize-space(*[2])='&#xAF;'">
462
+ <xsl:attribute
463
+ name="style">border-width: .1em 0pt 0pt 0pt; border-style: solid;"</xsl:attribute>
464
+ </xsl:if>
465
+ <span><xsl:apply-templates select="*[1]"/></span>
466
+ </span>
467
+ </xsl:template>
468
+
469
+ <h:p>munderover: </h:p>
470
+ <xsl:template match="m:munderover">
471
+ <table class="munderover">
472
+ <tr><td><xsl:apply-templates select="*[3]"/></td></tr>
473
+ <tr><td><xsl:apply-templates select="*[1]"/></td></tr>
474
+ <tr><td><xsl:apply-templates select="*[2]"/></td></tr>
475
+ </table>
476
+ </xsl:template>
477
+
478
+ <h:p>mtext: a simple span</h:p>
479
+ <xsl:template match="m:mtext">
480
+ <span class="mtext">
481
+ <xsl:value-of select="normalize-space(.)"/>
482
+ </span>
483
+ </xsl:template>
484
+
485
+ <h:p>mstyle: not many attributes currently supported</h:p>
486
+ <xsl:template match="m:mstyle">
487
+ <span>
488
+ <xsl:attribute name="style">
489
+ <xsl:if test="@color">color: <xsl:value-of select="@color"/>; </xsl:if>
490
+ <xsl:if test="@background">background-color: <xsl:value-of select="@background"/>; </xsl:if>
491
+ </xsl:attribute>
492
+ <xsl:apply-templates/>
493
+ </span>
494
+ </xsl:template>
495
+
496
+
497
+ <h:p>mglyph: Uses disable output escaping to construct a numeric
498
+ character reference. Uses IE's non conforming behaviour of using this
499
+ number to access the font encoding rather than unicode.</h:p>
500
+ <xsl:template match="m:mglyph">
501
+ <font face="{@fontfamily}"><xsl:value-of
502
+ disable-output-escaping="yes" select="'&amp;#'"/>
503
+ <xsl:value-of select="@index"/>;<xsl:text/>
504
+ </font>
505
+ </xsl:template>
506
+
507
+ <h:p>ms: a simple span with left and right character added to the content.</h:p>
508
+ <xsl:template match="m:ms">
509
+ <span class="ms">
510
+ <xsl:value-of select="@lquote"/><xsl:if test="not(@lquote)">"</xsl:if>
511
+ <xsl:value-of select="normalize-space(.)"/>
512
+ <xsl:value-of select="@rquote"/><xsl:if test="not(@rquote)">"</xsl:if>
513
+ </span>
514
+ </xsl:template>
515
+
516
+
517
+ <xsl:template match="m:math">
518
+ <xsl:call-template name="mrow"/>
519
+ </xsl:template>
520
+
521
+
522
+
523
+ <xsl:template match="m:mfenced">
524
+ <xsl:variable name="l">
525
+ <xsl:choose>
526
+ <xsl:when test="@open"><xsl:value-of select="@open"/></xsl:when>
527
+ <xsl:otherwise>(</xsl:otherwise>
528
+ </xsl:choose>
529
+ </xsl:variable>
530
+ <xsl:variable name="r">
531
+ <xsl:choose>
532
+ <xsl:when test="@close"><xsl:value-of select="@close"/></xsl:when>
533
+ <xsl:otherwise>)</xsl:otherwise>
534
+ </xsl:choose>
535
+ </xsl:variable>
536
+ <xsl:variable name="s">
537
+ <xsl:choose>
538
+ <xsl:when test="@sep">
539
+ <xsl:call-template name="text">
540
+ <xsl:with-param name="x" select="@sep"/>
541
+ </xsl:call-template>
542
+ </xsl:when>
543
+ <xsl:otherwise>,</xsl:otherwise>
544
+ </xsl:choose>
545
+ </xsl:variable>
546
+ <span id="{generate-id()}L"><xsl:value-of select="$l"/></span>
547
+ <span id="{generate-id()}M">
548
+ <xsl:for-each select="*">
549
+ <xsl:apply-templates select="."/>
550
+ <xsl:if test="position() != last()"><span id="{generate-id()}X{position()}"><xsl:value-of select="$s"/></span></xsl:if>
551
+ </xsl:for-each>
552
+ </span>
553
+ <span id="{generate-id()}R"><xsl:value-of select="$r"/></span>
554
+ <script>
555
+
556
+ <xsl:if test="$s=$opdict[@stretch='true']/@x">
557
+ <xsl:for-each select="*[position()&lt;last()]">
558
+ <xsl:variable name="opdictentry" select="$opdict[@x=$s]"/>
559
+ mrowStretch(<xsl:value-of select="concat(generate-id(),'X',position())"/>,"<xsl:value-of
560
+ select="$opdictentry/@top"/>","<xsl:value-of
561
+ select="$opdictentry/@extend"/>","<xsl:value-of
562
+ select="$opdictentry/@middle"/>","<xsl:value-of
563
+ select="$opdictentry/@bottom"/>");</xsl:for-each>
564
+ </xsl:if>
565
+
566
+ <xsl:variable name="opdictentry" select="$opdict[@x=$l]"/>
567
+ var mrowH = <xsl:value-of select="generate-id()"/>M.offsetHeight;
568
+ mrowStretch(<xsl:value-of select="generate-id()"/>L,"<xsl:value-of
569
+ select="$opdictentry/@top"/>","<xsl:value-of
570
+ select="$opdictentry/@extend"/>","<xsl:value-of
571
+ select="$opdictentry/@middle"/>","<xsl:value-of
572
+ select="$opdictentry/@bottom"/>");<xsl:text/>
573
+
574
+ <xsl:variable name="opdictentry2" select="$opdict[@x=$r]"/>
575
+ mrowStretch(<xsl:value-of select="generate-id()"/>R,"<xsl:value-of
576
+ select="$opdictentry2/@top"/>","<xsl:value-of
577
+ select="$opdictentry2/@extend"/>","<xsl:value-of
578
+ select="$opdictentry2/@middle"/>","<xsl:value-of
579
+ select="$opdictentry2/@bottom"/>");<xsl:text/>
580
+ </script>
581
+ </xsl:template>
582
+
583
+
584
+
585
+ <xsl:template match="m:mmultiscripts">
586
+ <table style="display:inline; vertical-align: middle;">
587
+ <tr>
588
+ <xsl:for-each select="*[preceding-sibling::m:mprescripts and position() mod 2 = 0]">
589
+ <td><xsl:apply-templates select="."/></td>
590
+ </xsl:for-each>
591
+ <td rowspan="2"><xsl:apply-templates select="*[1]"/></td>
592
+ <xsl:for-each select="*[not(preceding-sibling::m:mprescripts) and position() !=1 and position() mod 2 = 1]">
593
+ <td><xsl:apply-templates select="."/></td>
594
+ </xsl:for-each>
595
+ </tr>
596
+ <tr>
597
+ <xsl:for-each select="*[preceding-sibling::m:mprescripts and position() mod 2 = 1]">
598
+ <td><xsl:apply-templates select="."/></td>
599
+ </xsl:for-each>
600
+ <xsl:for-each select="*[not(preceding-sibling::m:mprescripts) and
601
+ not(self::m:mprescripts) and position() mod 2 = 0]">
602
+ <td><xsl:apply-templates select="."/></td>
603
+ </xsl:for-each>
604
+ </tr>
605
+ </table>
606
+ </xsl:template>
607
+
608
+
609
+ <xsl:template match="m:none">&#xFEFF;</xsl:template>
610
+
611
+ <xsl:template match="m:merror">
612
+ <span class="merror"><xsl:call-template name="mrow"/></span>
613
+ </xsl:template>
614
+
615
+ <xsl:template match="m:mphantom">
616
+ <span class="mphantom"><xsl:apply-templates/></span>
617
+ </xsl:template>
618
+
619
+ <xsl:template match="m:maction[@type='tooltip']">
620
+ <span title="{*[2]}"><xsl:apply-templates select="*[1]"/></span>
621
+ </xsl:template>
622
+
623
+ <xsl:template match="m:maction[@type='toggle']">
624
+ <span id="{generate-id()}" onclick="toggle({generate-id()})">
625
+ <span style="display:inline;"><xsl:apply-templates select="*[1]"/></span>
626
+ <xsl:for-each select="*[position() &gt; 1]">
627
+ <span style="display:none;"><xsl:apply-templates select="."/></span>
628
+ </xsl:for-each>
629
+ </span>
630
+ </xsl:template>
631
+
632
+
633
+ <xsl:template match="m:maction[@type='statusline']">
634
+ <span id="{generate-id()}"
635
+ onmouseover="window.status='{*[2]}';"
636
+ onmouseout="window.status='';"
637
+ >
638
+ <xsl:apply-templates select="*[1]"/></span>
639
+ </xsl:template>
640
+
641
+
642
+ <xsl:template match="m:maction[@type='highlight']">
643
+ <span id="{generate-id()}"
644
+ onmouseover="{generate-id()}.style.backgroundColor='yellow';"
645
+ onmouseout="{generate-id()}.style.backgroundColor='white';"><xsl:apply-templates/></span>
646
+ </xsl:template>
647
+
648
+
649
+
650
+ <xsl:template match="m:mrow" name="mrow">
651
+ <span id="{generate-id()}" class="mrow">
652
+ <xsl:apply-templates select="*"/>
653
+ </span>
654
+ <xsl:if test="m:mo[@stretch='true' or normalize-space(.)=$opdict[@stretch='true']/@x]">
655
+ <script>
656
+ var mrowH = <xsl:value-of select="generate-id()"/>.offsetHeight;
657
+ <xsl:for-each select="m:mo[@stretch='true' or
658
+ normalize-space(.)=$opdict[@stretch='true']/@x]">
659
+
660
+ <xsl:variable name="o" select="normalize-space(.)"/>
661
+ <xsl:variable name="opdictentry" select="$opdict[@x=$o]"/>
662
+ mrowStretch(<xsl:value-of select="generate-id()"/>,"<xsl:value-of
663
+ select="$opdictentry/@top"/>","<xsl:value-of
664
+ select="$opdictentry/@extend"/>","<xsl:value-of
665
+ select="$opdictentry/@middle"/>","<xsl:value-of
666
+ select="$opdictentry/@bottom"/>");</xsl:for-each>
667
+ </script>
668
+ </xsl:if>
669
+ </xsl:template>
670
+
671
+
672
+ <xsl:template match="m:msubsup">
673
+ <span id="{generate-id()}" >
674
+ <xsl:apply-templates select="*[1]"/></span
675
+ ><span id="{generate-id()}b" class="msubsup"><xsl:apply-templates
676
+ select="*[2]"/></span
677
+ ><span id="{generate-id()}p" class="msubsup"><xsl:apply-templates
678
+ select="*[3]"/></span
679
+ ><span id="{generate-id()}x">&#xFEFF;</span>
680
+ <script>
681
+ msubsup("<xsl:value-of select="concat(generate-id(),'&quot;,',generate-id(),',',generate-id(),'x,',generate-id(),'b,',generate-id())"/>p);
682
+ </script>
683
+ </xsl:template>
684
+
685
+ <xsl:template match="h:table//m:msubsup|m:mtable//m:msubsup|m:msubsup"
686
+ priority="2">
687
+ <span>
688
+ <xsl:apply-templates select="*[1]"/>
689
+ </span
690
+ ><sub><xsl:apply-templates
691
+ select="*[2]"/></sub>
692
+ <sup><xsl:apply-templates
693
+ select="*[3]"/></sup>
694
+ </xsl:template>
695
+
696
+ <xsl:template match="m:msup
697
+ ">
698
+ <span id="{generate-id()}">
699
+ <xsl:apply-templates select="*[1]"/>
700
+ </span
701
+ ><span id="{generate-id()}p" class="msubsup"><xsl:apply-templates
702
+ select="*[2]"/></span
703
+ ><span id="{generate-id()}x">&#xFEFF;</span>
704
+ <script>
705
+ msup("<xsl:value-of select="concat(generate-id(),'&quot;,',generate-id(),'x,',generate-id())"/>p);
706
+ </script>
707
+ </xsl:template>
708
+
709
+ <xsl:template match="h:table//m:msup|m:mtable//m:msup|m:msup"
710
+ priority="2">
711
+ <span>
712
+ <xsl:apply-templates select="*[1]"/>
713
+ </span
714
+ ><sup><xsl:apply-templates
715
+ select="*[2]"/></sup>
716
+ </xsl:template>
717
+
718
+ <xsl:template match="m:msub
719
+ ">
720
+ <span id="{generate-id()}">
721
+ <xsl:apply-templates select="*[1]"/>
722
+ </span
723
+ ><span id="{generate-id()}p" class="msubsup"><xsl:apply-templates
724
+ select="*[2]"/></span
725
+ ><span id="{generate-id()}x">&#xFEFF;</span>
726
+ <script>
727
+ msub("<xsl:value-of select="concat(generate-id(),'&quot;,',generate-id(),'x,',generate-id())"/>p);
728
+ </script>
729
+ </xsl:template>
730
+
731
+ <xsl:template match="h:table//m:msub|m:mtable//m:msub|m:msub"
732
+ priority="2">
733
+ <span>
734
+ <xsl:apply-templates select="*[1]"/>
735
+ </span
736
+ ><sub><xsl:apply-templates
737
+ select="*[2]"/></sub>
738
+ </xsl:template>
739
+
740
+
741
+ <xsl:template match="m:*/text()" name="text">
742
+ <xsl:param name="x" select="normalize-space(.)"/>
743
+ <xsl:variable name="mo" select="document('')/*/x:x[@x=$x]"/>
744
+ <xsl:choose>
745
+ <xsl:when test="$mo"><xsl:copy-of select="$mo/node()"/></xsl:when>
746
+ <xsl:otherwise><xsl:copy-of select="$x"/></xsl:otherwise>
747
+ </xsl:choose>
748
+ </xsl:template>
749
+
750
+
751
+ <xsl:template match="m:msqrt">
752
+ <span class="msqrtx">\&#xFEFF;</span><span class="msqrt">
753
+ <xsl:apply-templates/>
754
+ </span>
755
+ </xsl:template>
756
+
757
+ <xsl:template match="m:menclose[@notation='radical']">
758
+ <span class="msqrtx">\&#xFEFF;</span><span class="msqrt">
759
+ <xsl:apply-templates/>
760
+ </span>
761
+ </xsl:template>
762
+
763
+ <xsl:template match="m:menclose[@notation='actuarial']">
764
+ <span class="actuarial">
765
+ <xsl:apply-templates/>
766
+ </span>
767
+ </xsl:template>
768
+
769
+ <xsl:template match="m:menclose">
770
+ <span class="msqrt">
771
+ <xsl:apply-templates/>
772
+ </span>
773
+ </xsl:template>
774
+
775
+ <xsl:template match="m:mroot">
776
+ <span class="msqrtx"><sup><xsl:apply-templates select="*[2]"/></sup>\&#xFEFF;</span><span class="msqrt">
777
+ <xsl:apply-templates select="*[1]"/>
778
+ </span>
779
+ </xsl:template>
780
+
781
+
782
+ <xsl:template match="m:mfrac">
783
+ <xsl:param name="full" select="not(ancestor::m:mfrac)"/>
784
+ <table class="mfrac">
785
+ <xsl:if test="$full">
786
+ <xsl:attribute name="style">font-size: 75% ;</xsl:attribute>
787
+ </xsl:if>
788
+ <xsl:if test="not($full)">
789
+ <xsl:attribute name="style">font-size: 100% ;</xsl:attribute>
790
+ </xsl:if>
791
+ <tr id="a{generate-id()}" class="mfraca"><td class="mfracaa">
792
+ <xsl:apply-templates select="*[1]"/>
793
+ </td></tr>
794
+ <tr id="b{generate-id()}" class="mfracb"><td>
795
+ <xsl:apply-templates select="*[2]"/>
796
+ </td></tr>
797
+ </table><xsl:if test="$full"><script>
798
+ if ( a<xsl:value-of select="generate-id()"
799
+ />.offsetHeight > b<xsl:value-of select="generate-id()"
800
+ />.offsetHeight ) b<xsl:value-of select="generate-id()
801
+ "/>.style.setExpression("height",a<xsl:value-of select="generate-id()"/>.offsetHeight );
802
+ else a<xsl:value-of
803
+ select="generate-id()"/>.style.setExpression("height",b<xsl:value-of
804
+ select="generate-id()"/>.offsetHeight );
805
+ </script></xsl:if>
806
+ </xsl:template>
807
+
808
+ <xsl:template match="m:padded">
809
+ <span>
810
+ <xsl:attribute name="display">
811
+ </xsl:attribute>
812
+ <xsl:apply-templates/>
813
+ </span>
814
+ </xsl:template>
815
+
816
+
817
+ <xsl:template match="m:mspace">
818
+ <span style="padding-left: {@width};"></span>
819
+ </xsl:template>
820
+
821
+ <xsl:template match="m:mtable">
822
+ <table class="mtable">
823
+ <xsl:apply-templates/>
824
+ </table>
825
+ <script>
826
+ <xsl:variable name="t" select="."/>
827
+ <xsl:for-each select="m:mtr[1]/m:mtd">
828
+ <xsl:variable name="c" select="position()"/>
829
+ <xsl:for-each select="descendant::m:maligngroup">
830
+ <xsl:variable name="g" select="position()"/>
831
+ malign([<xsl:for-each
832
+ select="$t/m:mtr/m:mtd[$c]/descendant::m:maligngroup[$g]">
833
+ <xsl:value-of select="generate-id()"/>
834
+ <xsl:if test="position()&lt;last()">,</xsl:if>
835
+ </xsl:for-each>]);</xsl:for-each>
836
+ </xsl:for-each>
837
+ </script>
838
+ </xsl:template>
839
+
840
+ <xsl:template match="m:mtr">
841
+ <tr>
842
+ <xsl:apply-templates/>
843
+ </tr>
844
+ </xsl:template>
845
+
846
+
847
+ <xsl:template match="m:mtd">
848
+ <td>
849
+ <xsl:apply-templates/>
850
+ </td>
851
+ </xsl:template>
852
+
853
+ <xsl:template match="m:maligngroup">
854
+ <xsl:variable name="g">
855
+ <xsl:choose>
856
+ <xsl:when test="@groupalign">
857
+ </xsl:when>
858
+ <xsl:when test="ancestor::td/@groupalign">
859
+ </xsl:when>
860
+ <xsl:when test="ancestor::tr/@groupalign">
861
+ </xsl:when>
862
+ <xsl:when test="ancestor::table/@groupalign">
863
+ </xsl:when>
864
+
865
+ <xsl:otherwise>left</xsl:otherwise>
866
+ </xsl:choose>
867
+ </xsl:variable>
868
+ <span id="{generate-id()}">&#xFEFF;</span>
869
+ </xsl:template>
870
+
871
+
872
+ </xsl:stylesheet>