-
Notifications
You must be signed in to change notification settings - Fork 21
/
extractChars.xsl
129 lines (116 loc) · 4.14 KB
/
extractChars.xsl
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<xsl:strip-space elements="*"/>
<xsl:output method="text"/>
<xsl:template match="charlist">
<!-- We extract the list of characters from unicode.xml.
For the LaTeX commands, we use the 'AMS' set as a reference modulo
some modifications to match itex2MML's coverage.
See isLaTeXCharacterCommand and addLaTeXCommands in
generateCharCommands.py -->
<xsl:apply-templates select="character"/>
<!-- Some of the char combinations from itex2MML are not in unicode.xml,
so we add them here. -->
<xsl:text>U0003D-02237</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>OP</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>\Eqcolon</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>
</xsl:text>
<xsl:text>U02237-02212</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>OP</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>\Coloneq</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>
</xsl:text>
<xsl:text>U0003D-02237</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>OP</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>\Eqqcolon</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>
</xsl:text>
<xsl:text>U02212-02237</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>OP</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>\Eqcolon</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>
</xsl:text>
<xsl:text>U02236-02248</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>OP</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>\colonapprox</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>
</xsl:text>
<xsl:text>U2237-02248</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>OP</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>\Colonapprox</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>
</xsl:text>
<xsl:text>U02236-0223C</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>OP</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>\colonsim</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>
</xsl:text>
<xsl:text>U02237-0223C</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>OP</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>\Colonsim</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="character">
<!-- First handle the characters from the MathML operator dictionary -->
<xsl:if test="operator-dictionary">
<xsl:value-of select="@id"/>
<xsl:text> </xsl:text>
<xsl:text>OP</xsl:text>
<xsl:if test="operator-dictionary/@fence">
<xsl:text>F</xsl:text>
</xsl:if>
<xsl:if test="operator-dictionary/@movablelimits">
<xsl:text>M</xsl:text>
</xsl:if>
<xsl:if test="operator-dictionary/@stretchy">
<xsl:text>S</xsl:text>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:value-of select="AMS"/>
<xsl:text>
</xsl:text>
</xsl:if>
<!-- Then handle the characters that have a mathclass as well as a few
extra characters. -->
<xsl:if test="not(operator-dictionary) and
(unicodedata/@mathclass or
boolean(@id = 'U00024') or
boolean(@id = 'U000F0') or
boolean(@id = 'U003C2') or
boolean(@id = 'U0228A-0FE00') or
boolean(@id = 'U02268-0FE00') or
boolean(@id = 'U02269-0FE00') or
boolean(@id = 'U0228B-0FE00') or
boolean(@id = 'U02ACB-0FE00') or
boolean(@id = 'U02ACC-0FE00'))">
<xsl:value-of select="@id"/>
<xsl:text> </xsl:text>
<xsl:value-of select="unicodedata/@mathclass"/>
<xsl:if test="not(unicodedata/@mathclass)">
<xsl:text>?</xsl:text>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:value-of select="AMS"/>
<xsl:text>
</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>