54 |
53 |
55 (* symbol output *) |
54 (* symbol output *) |
56 |
55 |
57 local |
56 local |
58 val html_syms = Symtab.make |
57 val html_syms = Symtab.make |
59 [("\\<spacespace>", (2.0, " ")), |
58 [("\\<spacespace>", (2, " ")), |
60 ("\\<exclamdown>", (1.0, "¡")), |
59 ("\\<exclamdown>", (1, "¡")), |
61 ("\\<cent>", (1.0, "¢")), |
60 ("\\<cent>", (1, "¢")), |
62 ("\\<pounds>", (1.0, "£")), |
61 ("\\<pounds>", (1, "£")), |
63 ("\\<currency>", (1.0, "¤")), |
62 ("\\<currency>", (1, "¤")), |
64 ("\\<yen>", (1.0, "¥")), |
63 ("\\<yen>", (1, "¥")), |
65 ("\\<bar>", (1.0, "¦")), |
64 ("\\<bar>", (1, "¦")), |
66 ("\\<section>", (1.0, "§")), |
65 ("\\<section>", (1, "§")), |
67 ("\\<dieresis>", (1.0, "¨")), |
66 ("\\<dieresis>", (1, "¨")), |
68 ("\\<copyright>", (1.0, "©")), |
67 ("\\<copyright>", (1, "©")), |
69 ("\\<ordfeminine>", (1.0, "ª")), |
68 ("\\<ordfeminine>", (1, "ª")), |
70 ("\\<guillemotleft>", (1.0, "«")), |
69 ("\\<guillemotleft>", (1, "«")), |
71 ("\\<not>", (1.0, "¬")), |
70 ("\\<not>", (1, "¬")), |
72 ("\\<hyphen>", (1.0, "­")), |
71 ("\\<hyphen>", (1, "­")), |
73 ("\\<registered>", (1.0, "®")), |
72 ("\\<registered>", (1, "®")), |
74 ("\\<inverse>", (1.0, "¯")), |
73 ("\\<inverse>", (1, "¯")), |
75 ("\\<degree>", (1.0, "°")), |
74 ("\\<degree>", (1, "°")), |
76 ("\\<plusminus>", (1.0, "±")), |
75 ("\\<plusminus>", (1, "±")), |
77 ("\\<twosuperior>", (1.0, "²")), |
76 ("\\<twosuperior>", (1, "²")), |
78 ("\\<threesuperior>", (1.0, "³")), |
77 ("\\<threesuperior>", (1, "³")), |
79 ("\\<acute>", (1.0, "´")), |
78 ("\\<acute>", (1, "´")), |
80 ("\\<paragraph>", (1.0, "¶")), |
79 ("\\<paragraph>", (1, "¶")), |
81 ("\\<cdot>", (1.0, "·")), |
80 ("\\<cdot>", (1, "·")), |
82 ("\\<cedilla>", (1.0, "¸")), |
81 ("\\<cedilla>", (1, "¸")), |
83 ("\\<onesuperior>", (1.0, "¹")), |
82 ("\\<onesuperior>", (1, "¹")), |
84 ("\\<ordmasculine>", (1.0, "º")), |
83 ("\\<ordmasculine>", (1, "º")), |
85 ("\\<guillemotright>", (1.0, "»")), |
84 ("\\<guillemotright>", (1, "»")), |
86 ("\\<onequarter>", (1.0, "¼")), |
85 ("\\<onequarter>", (1, "¼")), |
87 ("\\<onehalf>", (1.0, "½")), |
86 ("\\<onehalf>", (1, "½")), |
88 ("\\<threequarters>", (1.0, "¾")), |
87 ("\\<threequarters>", (1, "¾")), |
89 ("\\<questiondown>", (1.0, "¿")), |
88 ("\\<questiondown>", (1, "¿")), |
90 ("\\<times>", (1.0, "×")), |
89 ("\\<times>", (1, "×")), |
91 ("\\<div>", (1.0, "÷")), |
90 ("\\<div>", (1, "÷")), |
92 ("\\<circ>", (1.0, "o")), |
91 ("\\<circ>", (1, "o")), |
93 ("\\<Alpha>", (1.0, "Α")), |
92 ("\\<Alpha>", (1, "Α")), |
94 ("\\<Beta>", (1.0, "Β")), |
93 ("\\<Beta>", (1, "Β")), |
95 ("\\<Gamma>", (1.0, "Γ")), |
94 ("\\<Gamma>", (1, "Γ")), |
96 ("\\<Delta>", (1.0, "Δ")), |
95 ("\\<Delta>", (1, "Δ")), |
97 ("\\<Epsilon>", (1.0, "Ε")), |
96 ("\\<Epsilon>", (1, "Ε")), |
98 ("\\<Zeta>", (1.0, "Ζ")), |
97 ("\\<Zeta>", (1, "Ζ")), |
99 ("\\<Eta>", (1.0, "Η")), |
98 ("\\<Eta>", (1, "Η")), |
100 ("\\<Theta>", (1.0, "Θ")), |
99 ("\\<Theta>", (1, "Θ")), |
101 ("\\<Iota>", (1.0, "Ι")), |
100 ("\\<Iota>", (1, "Ι")), |
102 ("\\<Kappa>", (1.0, "Κ")), |
101 ("\\<Kappa>", (1, "Κ")), |
103 ("\\<Lambda>", (1.0, "Λ")), |
102 ("\\<Lambda>", (1, "Λ")), |
104 ("\\<Mu>", (1.0, "Μ")), |
103 ("\\<Mu>", (1, "Μ")), |
105 ("\\<Nu>", (1.0, "Ν")), |
104 ("\\<Nu>", (1, "Ν")), |
106 ("\\<Xi>", (1.0, "Ξ")), |
105 ("\\<Xi>", (1, "Ξ")), |
107 ("\\<Omicron>", (1.0, "Ο")), |
106 ("\\<Omicron>", (1, "Ο")), |
108 ("\\<Pi>", (1.0, "Π")), |
107 ("\\<Pi>", (1, "Π")), |
109 ("\\<Rho>", (1.0, "Ρ")), |
108 ("\\<Rho>", (1, "Ρ")), |
110 ("\\<Sigma>", (1.0, "Σ")), |
109 ("\\<Sigma>", (1, "Σ")), |
111 ("\\<Tau>", (1.0, "Τ")), |
110 ("\\<Tau>", (1, "Τ")), |
112 ("\\<Upsilon>", (1.0, "Υ")), |
111 ("\\<Upsilon>", (1, "Υ")), |
113 ("\\<Phi>", (1.0, "Φ")), |
112 ("\\<Phi>", (1, "Φ")), |
114 ("\\<Chi>", (1.0, "Χ")), |
113 ("\\<Chi>", (1, "Χ")), |
115 ("\\<Psi>", (1.0, "Ψ")), |
114 ("\\<Psi>", (1, "Ψ")), |
116 ("\\<Omega>", (1.0, "Ω")), |
115 ("\\<Omega>", (1, "Ω")), |
117 ("\\<alpha>", (1.0, "α")), |
116 ("\\<alpha>", (1, "α")), |
118 ("\\<beta>", (1.0, "β")), |
117 ("\\<beta>", (1, "β")), |
119 ("\\<gamma>", (1.0, "γ")), |
118 ("\\<gamma>", (1, "γ")), |
120 ("\\<delta>", (1.0, "δ")), |
119 ("\\<delta>", (1, "δ")), |
121 ("\\<epsilon>", (1.0, "ε")), |
120 ("\\<epsilon>", (1, "ε")), |
122 ("\\<zeta>", (1.0, "ζ")), |
121 ("\\<zeta>", (1, "ζ")), |
123 ("\\<eta>", (1.0, "η")), |
122 ("\\<eta>", (1, "η")), |
124 ("\\<theta>", (1.0, "ϑ")), |
123 ("\\<theta>", (1, "ϑ")), |
125 ("\\<iota>", (1.0, "ι")), |
124 ("\\<iota>", (1, "ι")), |
126 ("\\<kappa>", (1.0, "κ")), |
125 ("\\<kappa>", (1, "κ")), |
127 ("\\<lambda>", (1.0, "λ")), |
126 ("\\<lambda>", (1, "λ")), |
128 ("\\<mu>", (1.0, "μ")), |
127 ("\\<mu>", (1, "μ")), |
129 ("\\<nu>", (1.0, "ν")), |
128 ("\\<nu>", (1, "ν")), |
130 ("\\<xi>", (1.0, "ξ")), |
129 ("\\<xi>", (1, "ξ")), |
131 ("\\<omicron>", (1.0, "ο")), |
130 ("\\<omicron>", (1, "ο")), |
132 ("\\<pi>", (1.0, "π")), |
131 ("\\<pi>", (1, "π")), |
133 ("\\<rho>", (1.0, "ρ")), |
132 ("\\<rho>", (1, "ρ")), |
134 ("\\<sigma>", (1.0, "σ")), |
133 ("\\<sigma>", (1, "σ")), |
135 ("\\<tau>", (1.0, "τ")), |
134 ("\\<tau>", (1, "τ")), |
136 ("\\<upsilon>", (1.0, "υ")), |
135 ("\\<upsilon>", (1, "υ")), |
137 ("\\<phi>", (1.0, "φ")), |
136 ("\\<phi>", (1, "φ")), |
138 ("\\<chi>", (1.0, "χ")), |
137 ("\\<chi>", (1, "χ")), |
139 ("\\<psi>", (1.0, "ψ")), |
138 ("\\<psi>", (1, "ψ")), |
140 ("\\<omega>", (1.0, "ω")), |
139 ("\\<omega>", (1, "ω")), |
141 ("\\<bullet>", (1.0, "•")), |
140 ("\\<bullet>", (1, "•")), |
142 ("\\<dots>", (1.0, "…")), |
141 ("\\<dots>", (1, "…")), |
143 ("\\<Re>", (1.0, "ℜ")), |
142 ("\\<Re>", (1, "ℜ")), |
144 ("\\<Im>", (1.0, "ℑ")), |
143 ("\\<Im>", (1, "ℑ")), |
145 ("\\<wp>", (1.0, "℘")), |
144 ("\\<wp>", (1, "℘")), |
146 ("\\<forall>", (1.0, "∀")), |
145 ("\\<forall>", (1, "∀")), |
147 ("\\<partial>", (1.0, "∂")), |
146 ("\\<partial>", (1, "∂")), |
148 ("\\<exists>", (1.0, "∃")), |
147 ("\\<exists>", (1, "∃")), |
149 ("\\<emptyset>", (1.0, "∅")), |
148 ("\\<emptyset>", (1, "∅")), |
150 ("\\<nabla>", (1.0, "∇")), |
149 ("\\<nabla>", (1, "∇")), |
151 ("\\<in>", (1.0, "∈")), |
150 ("\\<in>", (1, "∈")), |
152 ("\\<notin>", (1.0, "∉")), |
151 ("\\<notin>", (1, "∉")), |
153 ("\\<Prod>", (1.0, "∏")), |
152 ("\\<Prod>", (1, "∏")), |
154 ("\\<Sum>", (1.0, "∑")), |
153 ("\\<Sum>", (1, "∑")), |
155 ("\\<star>", (1.0, "∗")), |
154 ("\\<star>", (1, "∗")), |
156 ("\\<propto>", (1.0, "∝")), |
155 ("\\<propto>", (1, "∝")), |
157 ("\\<infinity>", (1.0, "∞")), |
156 ("\\<infinity>", (1, "∞")), |
158 ("\\<angle>", (1.0, "∠")), |
157 ("\\<angle>", (1, "∠")), |
159 ("\\<and>", (1.0, "∧")), |
158 ("\\<and>", (1, "∧")), |
160 ("\\<or>", (1.0, "∨")), |
159 ("\\<or>", (1, "∨")), |
161 ("\\<inter>", (1.0, "∩")), |
160 ("\\<inter>", (1, "∩")), |
162 ("\\<union>", (1.0, "∪")), |
161 ("\\<union>", (1, "∪")), |
163 ("\\<sim>", (1.0, "∼")), |
162 ("\\<sim>", (1, "∼")), |
164 ("\\<cong>", (1.0, "≅")), |
163 ("\\<cong>", (1, "≅")), |
165 ("\\<approx>", (1.0, "≈")), |
164 ("\\<approx>", (1, "≈")), |
166 ("\\<noteq>", (1.0, "≠")), |
165 ("\\<noteq>", (1, "≠")), |
167 ("\\<equiv>", (1.0, "≡")), |
166 ("\\<equiv>", (1, "≡")), |
168 ("\\<le>", (1.0, "≤")), |
167 ("\\<le>", (1, "≤")), |
169 ("\\<ge>", (1.0, "≥")), |
168 ("\\<ge>", (1, "≥")), |
170 ("\\<subset>", (1.0, "⊂")), |
169 ("\\<subset>", (1, "⊂")), |
171 ("\\<supset>", (1.0, "⊃")), |
170 ("\\<supset>", (1, "⊃")), |
172 ("\\<subseteq>", (1.0, "⊆")), |
171 ("\\<subseteq>", (1, "⊆")), |
173 ("\\<supseteq>", (1.0, "⊇")), |
172 ("\\<supseteq>", (1, "⊇")), |
174 ("\\<oplus>", (1.0, "⊕")), |
173 ("\\<oplus>", (1, "⊕")), |
175 ("\\<otimes>", (1.0, "⊗")), |
174 ("\\<otimes>", (1, "⊗")), |
176 ("\\<bottom>", (1.0, "⊥")), |
175 ("\\<bottom>", (1, "⊥")), |
177 ("\\<lceil>", (1.0, "⌈")), |
176 ("\\<lceil>", (1, "⌈")), |
178 ("\\<rceil>", (1.0, "⌉")), |
177 ("\\<rceil>", (1, "⌉")), |
179 ("\\<lfloor>", (1.0, "⌊")), |
178 ("\\<lfloor>", (1, "⌊")), |
180 ("\\<rfloor>", (1.0, "⌋")), |
179 ("\\<rfloor>", (1, "⌋")), |
181 ("\\<langle>", (1.0, "⟨")), |
180 ("\\<langle>", (1, "⟨")), |
182 ("\\<rangle>", (1.0, "⟩")), |
181 ("\\<rangle>", (1, "⟩")), |
183 ("\\<lozenge>", (1.0, "◊")), |
182 ("\\<lozenge>", (1, "◊")), |
184 ("\\<spadesuit>", (1.0, "♠")), |
183 ("\\<spadesuit>", (1, "♠")), |
185 ("\\<clubsuit>", (1.0, "♣")), |
184 ("\\<clubsuit>", (1, "♣")), |
186 ("\\<heartsuit>", (1.0, "♥")), |
185 ("\\<heartsuit>", (1, "♥")), |
187 ("\\<diamondsuit>", (1.0, "♦")), |
186 ("\\<diamondsuit>", (1, "♦")), |
188 ("\\<lbrakk>", (2.0, "[|")), |
187 ("\\<lbrakk>", (2, "[|")), |
189 ("\\<rbrakk>", (2.0, "|]")), |
188 ("\\<rbrakk>", (2, "|]")), |
190 ("\\<Longrightarrow>", (3.0, "==>")), |
189 ("\\<Longrightarrow>", (3, "==>")), |
191 ("\\<Rightarrow>", (2.0, "=>")), |
190 ("\\<Rightarrow>", (2, "=>")), |
192 ("\\<And>", (2.0, "!!")), |
191 ("\\<And>", (2, "!!")), |
193 ("\\<Colon>", (2.0, "::")), |
192 ("\\<Colon>", (2, "::")), |
194 ("\\<lparr>", (2.0, "(|")), |
193 ("\\<lparr>", (2, "(|")), |
195 ("\\<rparr>", (2.0, "|)),")), |
194 ("\\<rparr>", (2, "|)),")), |
196 ("\\<longleftrightarrow>", (3.0, "<->")), |
195 ("\\<longleftrightarrow>", (3, "<->")), |
197 ("\\<longrightarrow>", (3.0, "-->")), |
196 ("\\<longrightarrow>", (3, "-->")), |
198 ("\\<rightarrow>", (2.0, "->")), |
197 ("\\<rightarrow>", (2, "->")), |
199 ("\\<^bsub>", (0.0, "<sub>")), |
198 ("\\<^bsub>", (0, "<sub>")), |
200 ("\\<^esub>", (0.0, "</sub>")), |
199 ("\\<^esub>", (0, "</sub>")), |
201 ("\\<^bsup>", (0.0, "<sup>")), |
200 ("\\<^bsup>", (0, "<sup>")), |
202 ("\\<^esup>", (0.0, "</sup>"))]; |
201 ("\\<^esup>", (0, "</sup>"))]; |
203 |
202 |
204 val escape = fn "<" => "<" | ">" => ">" | "&" => "&" | c => c; |
203 val escape = fn "<" => "<" | ">" => ">" | "&" => "&" | c => c; |
205 |
204 |
206 fun output_sym s = |
205 fun output_sym s = |
207 if Symbol.is_raw s then (1.0, Symbol.decode_raw s) |
206 if Symbol.is_raw s then (1, Symbol.decode_raw s) |
208 else |
207 else |
209 (case Symtab.lookup html_syms s of SOME x => x |
208 (case Symtab.lookup html_syms s of SOME x => x |
210 | NONE => (real (size s), translate_string escape s)); |
209 | NONE => (size s, translate_string escape s)); |
211 |
210 |
212 fun output_sub s = apsnd (enclose "<sub>" "</sub>") (output_sym s); |
211 fun output_sub s = apsnd (enclose "<sub>" "</sub>") (output_sym s); |
213 fun output_sup s = apsnd (enclose "<sup>" "</sup>") (output_sym s); |
212 fun output_sup s = apsnd (enclose "<sup>" "</sup>") (output_sym s); |
214 fun output_loc s = apsnd (enclose "<span class=\"loc\">" "</span>") (output_sym s); |
213 fun output_loc s = apsnd (enclose "<span class=\"loc\">" "</span>") (output_sym s); |
215 |
214 |