md2man 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/HISTORY.markdown +36 -0
- data/LICENSE +15 -0
- data/README.markdown +106 -0
- data/Rakefile +1 -0
- data/bin/md2man +70 -0
- data/lib/md2man/engine.rb +18 -0
- data/lib/md2man/roff.rb +851 -0
- data/lib/md2man/version.rb +3 -0
- data/lib/md2man.rb +2 -0
- data/man/man1/md2man.1 +79 -0
- data/md2man.gemspec +25 -0
- data/test/md2man/roff_test.rb +584 -0
- data/test/test_helper.rb +2 -0
- metadata +125 -0
data/lib/md2man/roff.rb
ADDED
@@ -0,0 +1,851 @@
|
|
1
|
+
module Md2Man
|
2
|
+
module Roff
|
3
|
+
|
4
|
+
#---------------------------------------------------------------------------
|
5
|
+
# document-level processing
|
6
|
+
#---------------------------------------------------------------------------
|
7
|
+
|
8
|
+
def preprocess document
|
9
|
+
@ordered_list_id = 0
|
10
|
+
@table_cells = {}
|
11
|
+
document
|
12
|
+
end
|
13
|
+
|
14
|
+
def postprocess document
|
15
|
+
document.strip.
|
16
|
+
|
17
|
+
# ensure that spaces after URLs appear properly
|
18
|
+
gsub(/(?<=^\.[UM]E) \s/, "\n").
|
19
|
+
|
20
|
+
# encode references to other man pages as "hyperlinks"
|
21
|
+
gsub(/(\S+)(\([1-9nol]\)[[:punct:]]?\s*)/, "\n.BR \\1 \\2\n").
|
22
|
+
|
23
|
+
# squeeze blank lines to prevent double-spaced output
|
24
|
+
gsub(/^\n/, '')
|
25
|
+
end
|
26
|
+
|
27
|
+
#---------------------------------------------------------------------------
|
28
|
+
# block-level processing
|
29
|
+
#---------------------------------------------------------------------------
|
30
|
+
|
31
|
+
PARAGRAPH_INDENT = /^\s*$|^ (?=\S)/
|
32
|
+
|
33
|
+
def paragraph text
|
34
|
+
head, *body = text.lines.to_a
|
35
|
+
head_indented = head =~ PARAGRAPH_INDENT
|
36
|
+
body_indented = !body.empty? && body.all? {|s| s =~ PARAGRAPH_INDENT }
|
37
|
+
|
38
|
+
if head_indented || body_indented
|
39
|
+
macro = if head_indented && body_indented then :IP else :TP end
|
40
|
+
text.gsub! PARAGRAPH_INDENT, ''
|
41
|
+
else
|
42
|
+
macro = :PP
|
43
|
+
text.chomp!
|
44
|
+
end
|
45
|
+
|
46
|
+
"\n.#{macro}\n#{text}\n"
|
47
|
+
end
|
48
|
+
|
49
|
+
def block_code code, language
|
50
|
+
"\n.nf\n#{code.chomp}\n.fi\n"
|
51
|
+
end
|
52
|
+
|
53
|
+
def block_quote quote
|
54
|
+
"\n.RS\n#{quote.sub(/\n\.PP\n/, '').chomp}\n.RE\n"
|
55
|
+
end
|
56
|
+
|
57
|
+
def block_html html
|
58
|
+
warn "md2man/roff: block_html not implemented: #{html.inspect}"
|
59
|
+
end
|
60
|
+
|
61
|
+
def header text, level
|
62
|
+
macro =
|
63
|
+
case level
|
64
|
+
when 1 then :TH
|
65
|
+
when 2 then :SH
|
66
|
+
else :SS
|
67
|
+
end
|
68
|
+
"\n.#{macro} #{text.chomp}\n"
|
69
|
+
end
|
70
|
+
|
71
|
+
def hrule
|
72
|
+
"\n.ti 0\n\\l'\\n(.lu'\n"
|
73
|
+
end
|
74
|
+
|
75
|
+
def list contents, list_type
|
76
|
+
result = []
|
77
|
+
|
78
|
+
if list_type == :ordered
|
79
|
+
result << ".nr step#{@ordered_list_id} 0 1"
|
80
|
+
@ordered_list_id += 1
|
81
|
+
end
|
82
|
+
|
83
|
+
result << ".RS\n#{contents}\n.RE\n"
|
84
|
+
result.join("\n")
|
85
|
+
end
|
86
|
+
|
87
|
+
def list_item text, list_type
|
88
|
+
designator =
|
89
|
+
case list_type
|
90
|
+
when :ordered
|
91
|
+
"\\n+[step#{@ordered_list_id}]"
|
92
|
+
when :unordered
|
93
|
+
"\\(bu 2"
|
94
|
+
end
|
95
|
+
|
96
|
+
".IP #{designator}\n#{text.sub(/\A\n\.PP\n/, '').lstrip.chomp}\n"
|
97
|
+
end
|
98
|
+
|
99
|
+
def table header, body
|
100
|
+
head_rows = decode_table_rows(header)
|
101
|
+
body_rows = decode_table_rows(body)
|
102
|
+
|
103
|
+
".TS\nallbox;\n#{
|
104
|
+
[
|
105
|
+
head_rows.map do |row|
|
106
|
+
(['cb'] * row.length).join(TABLE_COL_DELIM)
|
107
|
+
end,
|
108
|
+
body_rows.map do |row|
|
109
|
+
row.map do |content, alignment|
|
110
|
+
(alignment || :left).to_s[0,1]
|
111
|
+
end.join(TABLE_COL_DELIM)
|
112
|
+
end
|
113
|
+
].join(TABLE_ROW_DELIM)
|
114
|
+
}\n.\n#{
|
115
|
+
(head_rows + body_rows).map do |row|
|
116
|
+
row.map(&:first).join(TABLE_CELL_DELIM)
|
117
|
+
end.join(TABLE_ROW_DELIM)
|
118
|
+
}\n.TE\n"
|
119
|
+
end
|
120
|
+
|
121
|
+
def table_row content
|
122
|
+
encode_table_row content
|
123
|
+
end
|
124
|
+
|
125
|
+
def table_cell content, alignment
|
126
|
+
encode_table_cell [content, alignment]
|
127
|
+
end
|
128
|
+
|
129
|
+
#---------------------------------------------------------------------------
|
130
|
+
# span-level processing
|
131
|
+
#---------------------------------------------------------------------------
|
132
|
+
|
133
|
+
def linebreak
|
134
|
+
"\n.br\n"
|
135
|
+
end
|
136
|
+
|
137
|
+
def emphasis text
|
138
|
+
"\\fI#{text}\\fP"
|
139
|
+
end
|
140
|
+
|
141
|
+
def double_emphasis text
|
142
|
+
"\\fB#{text}\\fP"
|
143
|
+
end
|
144
|
+
|
145
|
+
def triple_emphasis text
|
146
|
+
"\\s+2#{double_emphasis text}\\s-2"
|
147
|
+
end
|
148
|
+
|
149
|
+
def strikethrough text
|
150
|
+
warn "md2man/roff: strikethrough not implemented: #{text.inspect}"
|
151
|
+
end
|
152
|
+
|
153
|
+
def superscript text
|
154
|
+
warn "md2man/roff: superscript not implemented: #{text.inspect}"
|
155
|
+
end
|
156
|
+
|
157
|
+
def codespan code
|
158
|
+
# NOTE: this double font sequence gives us the best of both worlds:
|
159
|
+
# man(1) shows it in bold and `groff -Thtml` shows it in monospace
|
160
|
+
"\\fB\\fC#{code}\\fR"
|
161
|
+
end
|
162
|
+
|
163
|
+
def link link, title, content
|
164
|
+
content +
|
165
|
+
if link =~ /^mailto:/
|
166
|
+
autolink $', :email
|
167
|
+
else
|
168
|
+
autolink link, :url
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def autolink link, link_type
|
173
|
+
if link_type == :email
|
174
|
+
"\n.MT #{link.chomp}\n.ME "
|
175
|
+
else
|
176
|
+
"\n.UR #{link.chomp}\n.UE "
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
def image link, title, alt_text
|
181
|
+
warn "md2man/roff: image not implemented: #{link.inspect}"
|
182
|
+
end
|
183
|
+
|
184
|
+
def raw_html html
|
185
|
+
warn "md2man/roff: raw_html not implemented: #{html.inspect}"
|
186
|
+
end
|
187
|
+
|
188
|
+
#---------------------------------------------------------------------------
|
189
|
+
# low-level processing
|
190
|
+
#---------------------------------------------------------------------------
|
191
|
+
|
192
|
+
def normal_text text
|
193
|
+
text.gsub('-', '\\-') if text
|
194
|
+
end
|
195
|
+
|
196
|
+
def entity text
|
197
|
+
if unicode = entity_to_unicode(text)
|
198
|
+
unicode_to_glyph unicode
|
199
|
+
else
|
200
|
+
warn "md2man/roff: entity not implemented: #{text.inspect}"
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
private
|
205
|
+
|
206
|
+
TABLE_COL_DELIM = ' '
|
207
|
+
TABLE_ROW_DELIM = "\n"
|
208
|
+
TABLE_CELL_DELIM = "\t"
|
209
|
+
|
210
|
+
def decode_table_rows rows
|
211
|
+
rows.split(TABLE_ROW_DELIM).map do |row|
|
212
|
+
row.split(TABLE_CELL_DELIM).map do |cell|
|
213
|
+
@table_cells.delete cell
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
def encode_table_row row
|
219
|
+
row + TABLE_ROW_DELIM
|
220
|
+
end
|
221
|
+
|
222
|
+
def encode_table_cell cell
|
223
|
+
key = cell.object_id.to_s
|
224
|
+
@table_cells[key] = cell
|
225
|
+
key + TABLE_CELL_DELIM
|
226
|
+
end
|
227
|
+
|
228
|
+
def entity_to_unicode entity
|
229
|
+
if ENTITY_TO_UNICODE.key? entity
|
230
|
+
ENTITY_TO_UNICODE[entity]
|
231
|
+
elsif entity =~ /^&#(\d+);$/
|
232
|
+
$1.to_i
|
233
|
+
elsif entity =~ /^&#x(\h+);$/
|
234
|
+
$1.to_i(16)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
def unicode_to_glyph unicode
|
239
|
+
if UNICODE_TO_GLYPH.key? unicode
|
240
|
+
UNICODE_TO_GLYPH[unicode]
|
241
|
+
elsif unicode < 256
|
242
|
+
'\\[char%d]' % unicode
|
243
|
+
else
|
244
|
+
'\\[u%04x]' % unicode
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
# see http://www.w3.org/TR/xhtml1/dtds.html#h-A2
|
249
|
+
# see http://www.w3.org/TR/html4/sgml/entities.html
|
250
|
+
ENTITY_TO_UNICODE = {
|
251
|
+
'"' => 0x0022,
|
252
|
+
'&' => 0x0026,
|
253
|
+
''' => 0x0027,
|
254
|
+
'<' => 0x003c,
|
255
|
+
'>' => 0x003e,
|
256
|
+
' ' => 0x00a0,
|
257
|
+
'¡' => 0x00a1,
|
258
|
+
'¢' => 0x00a2,
|
259
|
+
'£' => 0x00a3,
|
260
|
+
'¤' => 0x00a4,
|
261
|
+
'¥' => 0x00a5,
|
262
|
+
'¦' => 0x00a6,
|
263
|
+
'§' => 0x00a7,
|
264
|
+
'¨' => 0x00a8,
|
265
|
+
'©' => 0x00a9,
|
266
|
+
'ª' => 0x00aa,
|
267
|
+
'«' => 0x00ab,
|
268
|
+
'¬' => 0x00ac,
|
269
|
+
'­' => 0x00ad,
|
270
|
+
'®' => 0x00ae,
|
271
|
+
'¯' => 0x00af,
|
272
|
+
'°' => 0x00b0,
|
273
|
+
'±' => 0x00b1,
|
274
|
+
'²' => 0x00b2,
|
275
|
+
'³' => 0x00b3,
|
276
|
+
'´' => 0x00b4,
|
277
|
+
'µ' => 0x00b5,
|
278
|
+
'¶' => 0x00b6,
|
279
|
+
'·' => 0x00b7,
|
280
|
+
'¸' => 0x00b8,
|
281
|
+
'¹' => 0x00b9,
|
282
|
+
'º' => 0x00ba,
|
283
|
+
'»' => 0x00bb,
|
284
|
+
'¼' => 0x00bc,
|
285
|
+
'½' => 0x00bd,
|
286
|
+
'¾' => 0x00be,
|
287
|
+
'¿' => 0x00bf,
|
288
|
+
'À' => 0x00c0,
|
289
|
+
'Á' => 0x00c1,
|
290
|
+
'Â' => 0x00c2,
|
291
|
+
'Ã' => 0x00c3,
|
292
|
+
'Ä' => 0x00c4,
|
293
|
+
'Å' => 0x00c5,
|
294
|
+
'Æ' => 0x00c6,
|
295
|
+
'Ç' => 0x00c7,
|
296
|
+
'È' => 0x00c8,
|
297
|
+
'É' => 0x00c9,
|
298
|
+
'Ê' => 0x00ca,
|
299
|
+
'Ë' => 0x00cb,
|
300
|
+
'Ì' => 0x00cc,
|
301
|
+
'Í' => 0x00cd,
|
302
|
+
'Î' => 0x00ce,
|
303
|
+
'Ï' => 0x00cf,
|
304
|
+
'Ð' => 0x00d0,
|
305
|
+
'Ñ' => 0x00d1,
|
306
|
+
'Ò' => 0x00d2,
|
307
|
+
'Ó' => 0x00d3,
|
308
|
+
'Ô' => 0x00d4,
|
309
|
+
'Õ' => 0x00d5,
|
310
|
+
'Ö' => 0x00d6,
|
311
|
+
'×' => 0x00d7,
|
312
|
+
'Ø' => 0x00d8,
|
313
|
+
'Ù' => 0x00d9,
|
314
|
+
'Ú' => 0x00da,
|
315
|
+
'Û' => 0x00db,
|
316
|
+
'Ü' => 0x00dc,
|
317
|
+
'Ý' => 0x00dd,
|
318
|
+
'Þ' => 0x00de,
|
319
|
+
'ß' => 0x00df,
|
320
|
+
'à' => 0x00e0,
|
321
|
+
'á' => 0x00e1,
|
322
|
+
'â' => 0x00e2,
|
323
|
+
'ã' => 0x00e3,
|
324
|
+
'ä' => 0x00e4,
|
325
|
+
'å' => 0x00e5,
|
326
|
+
'æ' => 0x00e6,
|
327
|
+
'ç' => 0x00e7,
|
328
|
+
'è' => 0x00e8,
|
329
|
+
'é' => 0x00e9,
|
330
|
+
'ê' => 0x00ea,
|
331
|
+
'ë' => 0x00eb,
|
332
|
+
'ì' => 0x00ec,
|
333
|
+
'í' => 0x00ed,
|
334
|
+
'î' => 0x00ee,
|
335
|
+
'ï' => 0x00ef,
|
336
|
+
'ð' => 0x00f0,
|
337
|
+
'ñ' => 0x00f1,
|
338
|
+
'ò' => 0x00f2,
|
339
|
+
'ó' => 0x00f3,
|
340
|
+
'ô' => 0x00f4,
|
341
|
+
'õ' => 0x00f5,
|
342
|
+
'ö' => 0x00f6,
|
343
|
+
'÷' => 0x00f7,
|
344
|
+
'ø' => 0x00f8,
|
345
|
+
'ù' => 0x00f9,
|
346
|
+
'ú' => 0x00fa,
|
347
|
+
'û' => 0x00fb,
|
348
|
+
'ü' => 0x00fc,
|
349
|
+
'ý' => 0x00fd,
|
350
|
+
'þ' => 0x00fe,
|
351
|
+
'ÿ' => 0x00ff,
|
352
|
+
'Œ' => 0x0152,
|
353
|
+
'œ' => 0x0153,
|
354
|
+
'Š' => 0x0160,
|
355
|
+
'š' => 0x0161,
|
356
|
+
'Ÿ' => 0x0178,
|
357
|
+
'ƒ' => 0x0192,
|
358
|
+
'ˆ' => 0x02c6,
|
359
|
+
'˜' => 0x02dc,
|
360
|
+
'Α' => 0x0391,
|
361
|
+
'Β' => 0x0392,
|
362
|
+
'Γ' => 0x0393,
|
363
|
+
'Δ' => 0x0394,
|
364
|
+
'Ε' => 0x0395,
|
365
|
+
'Ζ' => 0x0396,
|
366
|
+
'Η' => 0x0397,
|
367
|
+
'Θ' => 0x0398,
|
368
|
+
'Ι' => 0x0399,
|
369
|
+
'Κ' => 0x039a,
|
370
|
+
'Λ' => 0x039b,
|
371
|
+
'Μ' => 0x039c,
|
372
|
+
'Ν' => 0x039d,
|
373
|
+
'Ξ' => 0x039e,
|
374
|
+
'Ο' => 0x039f,
|
375
|
+
'Π' => 0x03a0,
|
376
|
+
'Ρ' => 0x03a1,
|
377
|
+
'Σ' => 0x03a3,
|
378
|
+
'Τ' => 0x03a4,
|
379
|
+
'Υ' => 0x03a5,
|
380
|
+
'Φ' => 0x03a6,
|
381
|
+
'Χ' => 0x03a7,
|
382
|
+
'Ψ' => 0x03a8,
|
383
|
+
'Ω' => 0x03a9,
|
384
|
+
'α' => 0x03b1,
|
385
|
+
'β' => 0x03b2,
|
386
|
+
'γ' => 0x03b3,
|
387
|
+
'δ' => 0x03b4,
|
388
|
+
'ε' => 0x03b5,
|
389
|
+
'ζ' => 0x03b6,
|
390
|
+
'η' => 0x03b7,
|
391
|
+
'θ' => 0x03b8,
|
392
|
+
'ι' => 0x03b9,
|
393
|
+
'κ' => 0x03ba,
|
394
|
+
'λ' => 0x03bb,
|
395
|
+
'μ' => 0x03bc,
|
396
|
+
'ν' => 0x03bd,
|
397
|
+
'ξ' => 0x03be,
|
398
|
+
'ο' => 0x03bf,
|
399
|
+
'π' => 0x03c0,
|
400
|
+
'ρ' => 0x03c1,
|
401
|
+
'ς' => 0x03c2,
|
402
|
+
'σ' => 0x03c3,
|
403
|
+
'τ' => 0x03c4,
|
404
|
+
'υ' => 0x03c5,
|
405
|
+
'φ' => 0x03c6,
|
406
|
+
'χ' => 0x03c7,
|
407
|
+
'ψ' => 0x03c8,
|
408
|
+
'ω' => 0x03c9,
|
409
|
+
'ϑ' => 0x03d1,
|
410
|
+
'ϒ' => 0x03d2,
|
411
|
+
'ϖ' => 0x03d6,
|
412
|
+
' ' => 0x2002,
|
413
|
+
' ' => 0x2003,
|
414
|
+
' ' => 0x2009,
|
415
|
+
'‌' => 0x200c,
|
416
|
+
'‍' => 0x200d,
|
417
|
+
'‎' => 0x200e,
|
418
|
+
'‏' => 0x200f,
|
419
|
+
'–' => 0x2013,
|
420
|
+
'—' => 0x2014,
|
421
|
+
'‘' => 0x2018,
|
422
|
+
'’' => 0x2019,
|
423
|
+
'‚' => 0x201a,
|
424
|
+
'“' => 0x201c,
|
425
|
+
'”' => 0x201d,
|
426
|
+
'„' => 0x201e,
|
427
|
+
'†' => 0x2020,
|
428
|
+
'‡' => 0x2021,
|
429
|
+
'•' => 0x2022,
|
430
|
+
'…' => 0x2026,
|
431
|
+
'‰' => 0x2030,
|
432
|
+
'′' => 0x2032,
|
433
|
+
'″' => 0x2033,
|
434
|
+
'‹' => 0x2039,
|
435
|
+
'›' => 0x203a,
|
436
|
+
'‾' => 0x203e,
|
437
|
+
'⁄' => 0x2044,
|
438
|
+
'€' => 0x20ac,
|
439
|
+
'ℑ' => 0x2111,
|
440
|
+
'℘' => 0x2118,
|
441
|
+
'ℜ' => 0x211c,
|
442
|
+
'™' => 0x2122,
|
443
|
+
'ℵ' => 0x2135,
|
444
|
+
'←' => 0x2190,
|
445
|
+
'↑' => 0x2191,
|
446
|
+
'→' => 0x2192,
|
447
|
+
'↓' => 0x2193,
|
448
|
+
'↔' => 0x2194,
|
449
|
+
'↵' => 0x21b5,
|
450
|
+
'⇐' => 0x21d0,
|
451
|
+
'⇑' => 0x21d1,
|
452
|
+
'⇒' => 0x21d2,
|
453
|
+
'⇓' => 0x21d3,
|
454
|
+
'⇔' => 0x21d4,
|
455
|
+
'∀' => 0x2200,
|
456
|
+
'∂' => 0x2202,
|
457
|
+
'∃' => 0x2203,
|
458
|
+
'∅' => 0x2205,
|
459
|
+
'∇' => 0x2207,
|
460
|
+
'∈' => 0x2208,
|
461
|
+
'∉' => 0x2209,
|
462
|
+
'∋' => 0x220b,
|
463
|
+
'∏' => 0x220f,
|
464
|
+
'∑' => 0x2211,
|
465
|
+
'−' => 0x2212,
|
466
|
+
'∗' => 0x2217,
|
467
|
+
'√' => 0x221a,
|
468
|
+
'∝' => 0x221d,
|
469
|
+
'∞' => 0x221e,
|
470
|
+
'∠' => 0x2220,
|
471
|
+
'∧' => 0x2227,
|
472
|
+
'∨' => 0x2228,
|
473
|
+
'∩' => 0x2229,
|
474
|
+
'∪' => 0x222a,
|
475
|
+
'∫' => 0x222b,
|
476
|
+
'∴' => 0x2234,
|
477
|
+
'∼' => 0x223c,
|
478
|
+
'≅' => 0x2245,
|
479
|
+
'≈' => 0x2248,
|
480
|
+
'≠' => 0x2260,
|
481
|
+
'≡' => 0x2261,
|
482
|
+
'≤' => 0x2264,
|
483
|
+
'≥' => 0x2265,
|
484
|
+
'⊂' => 0x2282,
|
485
|
+
'⊃' => 0x2283,
|
486
|
+
'⊄' => 0x2284,
|
487
|
+
'⊆' => 0x2286,
|
488
|
+
'⊇' => 0x2287,
|
489
|
+
'⊕' => 0x2295,
|
490
|
+
'⊗' => 0x2297,
|
491
|
+
'⊥' => 0x22a5,
|
492
|
+
'⋅' => 0x22c5,
|
493
|
+
'⌈' => 0x2308,
|
494
|
+
'⌉' => 0x2309,
|
495
|
+
'⌊' => 0x230a,
|
496
|
+
'⌋' => 0x230b,
|
497
|
+
'⟨' => 0x2329,
|
498
|
+
'⟩' => 0x232a,
|
499
|
+
'◊' => 0x25ca,
|
500
|
+
'♠' => 0x2660,
|
501
|
+
'♣' => 0x2663,
|
502
|
+
'♥' => 0x2665,
|
503
|
+
'♦' => 0x2666,
|
504
|
+
}.freeze
|
505
|
+
|
506
|
+
# see groff_char(7) and "Special Characters" in groff(7)
|
507
|
+
UNICODE_TO_GLYPH = {
|
508
|
+
0x0022 => "\\[dq]",
|
509
|
+
0x0023 => "\\[sh]",
|
510
|
+
0x0024 => "\\[Do]",
|
511
|
+
0x0026 => '&',
|
512
|
+
0x0027 => "\\[aq]",
|
513
|
+
0x002b => "\\[pl]",
|
514
|
+
0x002f => "\\[sl]",
|
515
|
+
0x003c => '<',
|
516
|
+
0x003d => "\\[eq]",
|
517
|
+
0x003e => '>',
|
518
|
+
0x0040 => "\\[at]",
|
519
|
+
0x005b => "\\[lB]",
|
520
|
+
0x005c => "\\[rs]",
|
521
|
+
0x005d => "\\[rB]",
|
522
|
+
0x005e => "\\[ha]",
|
523
|
+
0x005f => "\\[nl]",
|
524
|
+
0x007b => "\\[lC]",
|
525
|
+
0x007c => "\\[ba]",
|
526
|
+
#0x007c => "\\[or]",
|
527
|
+
0x007d => "\\[rC]",
|
528
|
+
0x007e => "\\[ti]",
|
529
|
+
0x00a0 => "\\~",
|
530
|
+
0x00a1 => "\\[r!]",
|
531
|
+
0x00a2 => "\\[ct]",
|
532
|
+
0x00a3 => "\\[Po]",
|
533
|
+
0x00a4 => "\\[Cs]",
|
534
|
+
0x00a5 => "\\[Ye]",
|
535
|
+
0x00a6 => "\\[bb]",
|
536
|
+
0x00a7 => "\\[sc]",
|
537
|
+
0x00a8 => "\\[ad]",
|
538
|
+
0x00a9 => "\\[co]",
|
539
|
+
0x00aa => "\\[Of]",
|
540
|
+
0x00ab => "\\[Fo]",
|
541
|
+
0x00ac => "\\[no]",
|
542
|
+
#0x00ac => "\\[tno]",
|
543
|
+
0x00ad => '-',
|
544
|
+
0x00ae => "\\[rg]",
|
545
|
+
0x00af => "\\[a-]",
|
546
|
+
0x00b0 => "\\[de]",
|
547
|
+
0x00b1 => "\\[+-]",
|
548
|
+
#0x00b1 => "\\[t+-]",
|
549
|
+
0x00b2 => "\\[S2]",
|
550
|
+
0x00b3 => "\\[S3]",
|
551
|
+
0x00b4 => "\\[aa]",
|
552
|
+
0x00b5 => "\\[mc]",
|
553
|
+
0x00b6 => "\\[ps]",
|
554
|
+
0x00b7 => "\\[pc]",
|
555
|
+
0x00b8 => "\\[ac]",
|
556
|
+
0x00b9 => "\\[S1]",
|
557
|
+
0x00ba => "\\[Om]",
|
558
|
+
0x00bb => "\\[Fc]",
|
559
|
+
0x00bc => "\\[14]",
|
560
|
+
0x00bd => "\\[12]",
|
561
|
+
0x00be => "\\[34]",
|
562
|
+
0x00bf => "\\[r?]",
|
563
|
+
0x00c0 => "\\[`A]",
|
564
|
+
0x00c1 => "\\['A]",
|
565
|
+
0x00c2 => "\\[^A]",
|
566
|
+
0x00c3 => "\\[~A]",
|
567
|
+
0x00c4 => "\\[:A]",
|
568
|
+
0x00c5 => "\\[oA]",
|
569
|
+
0x00c6 => "\\[AE]",
|
570
|
+
0x00c7 => "\\[,C]",
|
571
|
+
0x00c8 => "\\[`E]",
|
572
|
+
0x00c9 => "\\['E]",
|
573
|
+
0x00ca => "\\[^E]",
|
574
|
+
0x00cb => "\\[:E]",
|
575
|
+
0x00cc => "\\[`I]",
|
576
|
+
0x00cd => "\\['I]",
|
577
|
+
0x00ce => "\\[^I]",
|
578
|
+
0x00cf => "\\[:I]",
|
579
|
+
0x00d0 => "\\[-D]",
|
580
|
+
0x00d1 => "\\[~N]",
|
581
|
+
0x00d2 => "\\[`O]",
|
582
|
+
0x00d3 => "\\['O]",
|
583
|
+
0x00d4 => "\\[^O]",
|
584
|
+
0x00d5 => "\\[~O]",
|
585
|
+
0x00d6 => "\\[:O]",
|
586
|
+
0x00d7 => "\\[mu]",
|
587
|
+
#0x00d7 => "\\[tmu]",
|
588
|
+
0x00d8 => "\\[/O]",
|
589
|
+
0x00d9 => "\\[`U]",
|
590
|
+
0x00da => "\\['U]",
|
591
|
+
0x00db => "\\[^U]",
|
592
|
+
0x00dc => "\\[:U]",
|
593
|
+
0x00dd => "\\['Y]",
|
594
|
+
0x00de => "\\[TP]",
|
595
|
+
0x00df => "\\[ss]",
|
596
|
+
0x00e0 => "\\[`a]",
|
597
|
+
0x00e1 => "\\['a]",
|
598
|
+
0x00e2 => "\\[^a]",
|
599
|
+
0x00e3 => "\\[~a]",
|
600
|
+
0x00e4 => "\\[:a]",
|
601
|
+
0x00e5 => "\\[oa]",
|
602
|
+
0x00e6 => "\\[ae]",
|
603
|
+
0x00e7 => "\\[,c]",
|
604
|
+
0x00e8 => "\\[`e]",
|
605
|
+
0x00e9 => "\\['e]",
|
606
|
+
0x00ea => "\\[^e]",
|
607
|
+
0x00eb => "\\[:e]",
|
608
|
+
0x00ec => "\\[`i]",
|
609
|
+
0x00ed => "\\['i]",
|
610
|
+
0x00ee => "\\[^i]",
|
611
|
+
0x00ef => "\\[:i]",
|
612
|
+
0x00f0 => "\\[Sd]",
|
613
|
+
0x00f1 => "\\[~n]",
|
614
|
+
0x00f2 => "\\[`o]",
|
615
|
+
0x00f3 => "\\['o]",
|
616
|
+
0x00f4 => "\\[^o]",
|
617
|
+
0x00f5 => "\\[~o]",
|
618
|
+
0x00f6 => "\\[:o]",
|
619
|
+
0x00f7 => "\\[di]",
|
620
|
+
#0x00f7 => "\\[tdi]",
|
621
|
+
0x00f8 => "\\[/o]",
|
622
|
+
0x00f9 => "\\[`u]",
|
623
|
+
0x00fa => "\\['u]",
|
624
|
+
0x00fb => "\\[^u]",
|
625
|
+
0x00fc => "\\[:u]",
|
626
|
+
0x00fd => "\\['y]",
|
627
|
+
0x00fe => "\\[Tp]",
|
628
|
+
0x00ff => "\\[:y]",
|
629
|
+
0x0131 => "\\[.i]",
|
630
|
+
0x0132 => "\\[IJ]",
|
631
|
+
0x0133 => "\\[ij]",
|
632
|
+
0x0141 => "\\[/L]",
|
633
|
+
0x0142 => "\\[/l]",
|
634
|
+
0x0152 => "\\[OE]",
|
635
|
+
0x0153 => "\\[oe]",
|
636
|
+
0x0160 => "\\[vS]",
|
637
|
+
0x0161 => "\\[vs]",
|
638
|
+
0x0178 => "\\[:Y]",
|
639
|
+
0x0192 => "\\[Fn]",
|
640
|
+
0x02c6 => "\\[a^]",
|
641
|
+
0x02dc => "\\[a~]",
|
642
|
+
0x0300 => "\\[ga]",
|
643
|
+
0x0301 => "\\[aa]",
|
644
|
+
0x0302 => "\\[a^]",
|
645
|
+
0x0303 => "\\[a~]",
|
646
|
+
0x0304 => "\\[a-]",
|
647
|
+
0x0306 => "\\[ab]",
|
648
|
+
0x0307 => "\\[a.]",
|
649
|
+
0x0308 => "\\[ad]",
|
650
|
+
0x030a => "\\[ao]",
|
651
|
+
0x030b => '\\[a"]',
|
652
|
+
0x030c => "\\[ah]",
|
653
|
+
0x0327 => "\\[ac]",
|
654
|
+
0x0328 => "\\[ho]",
|
655
|
+
0x0391 => "\\[*A]",
|
656
|
+
0x0392 => "\\[*B]",
|
657
|
+
0x0393 => "\\[*G]",
|
658
|
+
0x0394 => "\\[*D]",
|
659
|
+
0x0395 => "\\[*E]",
|
660
|
+
0x0396 => "\\[*Z]",
|
661
|
+
0x0397 => "\\[*Y]",
|
662
|
+
0x0398 => "\\[*H]",
|
663
|
+
0x0399 => "\\[*I]",
|
664
|
+
0x039a => "\\[*K]",
|
665
|
+
0x039b => "\\[*L]",
|
666
|
+
0x039c => "\\[*M]",
|
667
|
+
0x039d => "\\[*N]",
|
668
|
+
0x039e => "\\[*C]",
|
669
|
+
0x039f => "\\[*O]",
|
670
|
+
0x03a0 => "\\[*P]",
|
671
|
+
0x03a1 => "\\[*R]",
|
672
|
+
0x03a3 => "\\[*S]",
|
673
|
+
0x03a4 => "\\[*T]",
|
674
|
+
0x03a5 => "\\[*U]",
|
675
|
+
0x03a6 => "\\[*F]",
|
676
|
+
0x03a7 => "\\[*X]",
|
677
|
+
0x03a8 => "\\[*Q]",
|
678
|
+
0x03a9 => "\\[*W]",
|
679
|
+
0x03b1 => "\\[*a]",
|
680
|
+
0x03b2 => "\\[*b]",
|
681
|
+
0x03b3 => "\\[*g]",
|
682
|
+
0x03b4 => "\\[*d]",
|
683
|
+
0x03b5 => "\\[*e]",
|
684
|
+
0x03b6 => "\\[*z]",
|
685
|
+
0x03b7 => "\\[*y]",
|
686
|
+
0x03b8 => "\\[*h]",
|
687
|
+
0x03b9 => "\\[*i]",
|
688
|
+
0x03ba => "\\[*k]",
|
689
|
+
0x03bb => "\\[*l]",
|
690
|
+
0x03bc => "\\[*m]",
|
691
|
+
0x03bd => "\\[*n]",
|
692
|
+
0x03be => "\\[*c]",
|
693
|
+
0x03bf => "\\[*o]",
|
694
|
+
0x03c0 => "\\[*p]",
|
695
|
+
0x03c1 => "\\[*r]",
|
696
|
+
0x03c2 => "\\[ts]",
|
697
|
+
0x03c3 => "\\[*s]",
|
698
|
+
0x03c4 => "\\[*t]",
|
699
|
+
0x03c5 => "\\[*u]",
|
700
|
+
0x03c6 => "\\[+f]",
|
701
|
+
0x03c7 => "\\[*x]",
|
702
|
+
0x03c8 => "\\[*q]",
|
703
|
+
0x03c9 => "\\[*w]",
|
704
|
+
0x03d1 => "\\[+h]",
|
705
|
+
0x03d5 => "\\[*f]",
|
706
|
+
0x03d6 => "\\[+p]",
|
707
|
+
0x03f5 => "\\[+e]",
|
708
|
+
0x2010 => "\\[hy]",
|
709
|
+
0x2013 => "\\[en]",
|
710
|
+
0x2014 => "\\[em]",
|
711
|
+
0x2018 => "\\[oq]",
|
712
|
+
0x2019 => "\\[cq]",
|
713
|
+
0x201a => "\\[bq]",
|
714
|
+
0x201c => "\\[lq]",
|
715
|
+
0x201d => "\\[rq]",
|
716
|
+
0x201e => "\\[Bq]",
|
717
|
+
0x2020 => "\\[dg]",
|
718
|
+
0x2021 => "\\[dd]",
|
719
|
+
0x2022 => "\\[bu]",
|
720
|
+
0x2030 => "\\[%0]",
|
721
|
+
0x2032 => "\\[fm]",
|
722
|
+
0x2033 => "\\[sd]",
|
723
|
+
0x2039 => "\\[fo]",
|
724
|
+
0x203a => "\\[fc]",
|
725
|
+
0x203e => "\\[rn]",
|
726
|
+
0x2044 => "\\[f/]",
|
727
|
+
#0x20ac => "\\[Eu]",
|
728
|
+
0x20ac => "\\[eu]",
|
729
|
+
0x210f => "\\[-h]",
|
730
|
+
#0x210f => "\\[hbar]",
|
731
|
+
0x2111 => "\\[Im]",
|
732
|
+
0x2118 => "\\[wp]",
|
733
|
+
0x211c => "\\[Re]",
|
734
|
+
0x2122 => "\\[tm]",
|
735
|
+
0x2135 => "\\[Ah]",
|
736
|
+
0x215b => "\\[18]",
|
737
|
+
0x215c => "\\[38]",
|
738
|
+
0x215d => "\\[58]",
|
739
|
+
0x215e => "\\[78]",
|
740
|
+
0x2190 => "\\[<-]",
|
741
|
+
0x2191 => "\\[ua]",
|
742
|
+
0x2192 => "\\[->]",
|
743
|
+
0x2193 => "\\[da]",
|
744
|
+
0x2194 => "\\[<>]",
|
745
|
+
0x2195 => "\\[va]",
|
746
|
+
0x21b5 => "\\[CR]",
|
747
|
+
0x21d0 => "\\[lA]",
|
748
|
+
0x21d1 => "\\[uA]",
|
749
|
+
0x21d2 => "\\[rA]",
|
750
|
+
0x21d3 => "\\[dA]",
|
751
|
+
0x21d4 => "\\[hA]",
|
752
|
+
0x21d5 => "\\[vA]",
|
753
|
+
0x2200 => "\\[fa]",
|
754
|
+
0x2202 => "\\[pd]",
|
755
|
+
0x2203 => "\\[te]",
|
756
|
+
0x2205 => "\\[es]",
|
757
|
+
0x2207 => "\\[gr]",
|
758
|
+
0x2208 => "\\[mo]",
|
759
|
+
0x2209 => "\\[nm]",
|
760
|
+
0x220b => "\\[st]",
|
761
|
+
0x220f => "\\[product]",
|
762
|
+
0x2210 => "\\[coproduct]",
|
763
|
+
0x2211 => "\\[sum]",
|
764
|
+
0x2212 => "\\[mi]",
|
765
|
+
0x2213 => "\\[-+]",
|
766
|
+
0x2217 => "\\[**]",
|
767
|
+
#0x221a => "\\[sqrt]",
|
768
|
+
0x221a => "\\[sr]",
|
769
|
+
0x221d => "\\[pt]",
|
770
|
+
0x221e => "\\[if]",
|
771
|
+
0x2220 => "\\[/_]",
|
772
|
+
0x2227 => "\\[AN]",
|
773
|
+
0x2228 => "\\[OR]",
|
774
|
+
0x2229 => "\\[ca]",
|
775
|
+
0x222a => "\\[cu]",
|
776
|
+
#0x222b => "\\[integral]",
|
777
|
+
0x222b => "\\[is]",
|
778
|
+
0x2234 => "\\[3d]",
|
779
|
+
#0x2234 => "\\[tf]",
|
780
|
+
0x223c => "\\[ap]",
|
781
|
+
0x2243 => "\\[|=]",
|
782
|
+
0x2245 => "\\[=~]",
|
783
|
+
#0x2248 => "\\[~=]",
|
784
|
+
0x2248 => "\\[~~]",
|
785
|
+
0x2260 => "\\[!=]",
|
786
|
+
0x2261 => "\\[==]",
|
787
|
+
0x2264 => "\\[<=]",
|
788
|
+
0x2265 => "\\[>=]",
|
789
|
+
0x226a => "\\[<<]",
|
790
|
+
0x226b => "\\[>>]",
|
791
|
+
0x2282 => "\\[sb]",
|
792
|
+
0x2283 => "\\[sp]",
|
793
|
+
0x2284 => "\\[nb]",
|
794
|
+
0x2286 => "\\[ib]",
|
795
|
+
0x2287 => "\\[ip]",
|
796
|
+
0x2295 => "\\[c+]",
|
797
|
+
0x2297 => "\\[c*]",
|
798
|
+
0x22a5 => "\\[pp]",
|
799
|
+
0x22c5 => "\\[md]",
|
800
|
+
0x2308 => "\\[lc]",
|
801
|
+
0x2309 => "\\[rc]",
|
802
|
+
0x230a => "\\[lf]",
|
803
|
+
0x230b => "\\[rf]",
|
804
|
+
0x2329 => "\\[la]",
|
805
|
+
0x232a => "\\[ra]",
|
806
|
+
0x239b => "\\[parenlefttp]",
|
807
|
+
0x239c => "\\[parenleftex]",
|
808
|
+
0x239d => "\\[parenleftbt]",
|
809
|
+
0x239e => "\\[parenrighttp]",
|
810
|
+
0x239f => "\\[parenrightex]",
|
811
|
+
0x23a0 => "\\[parenrightbt]",
|
812
|
+
0x23a1 => "\\[bracketlefttp]",
|
813
|
+
0x23a2 => "\\[bracketleftex]",
|
814
|
+
0x23a3 => "\\[bracketleftbt]",
|
815
|
+
0x23a4 => "\\[bracketrighttp]",
|
816
|
+
0x23a5 => "\\[bracketrightex]",
|
817
|
+
0x23a6 => "\\[bracketrightbt]",
|
818
|
+
#0x23a7 => "\\[bracelefttp]",
|
819
|
+
0x23a7 => "\\[lt]",
|
820
|
+
#0x23a8 => "\\[braceleftmid]",
|
821
|
+
0x23a8 => "\\[lk]",
|
822
|
+
#0x23a9 => "\\[braceleftbt]",
|
823
|
+
0x23a9 => "\\[lb]",
|
824
|
+
#0x23aa => "\\[braceex]",
|
825
|
+
#0x23aa => "\\[braceleftex]",
|
826
|
+
#0x23aa => "\\[bracerightex]",
|
827
|
+
0x23aa => "\\[bv]",
|
828
|
+
#0x23ab => "\\[bracerighttp]",
|
829
|
+
0x23ab => "\\[rt]",
|
830
|
+
#0x23ac => "\\[bracerightmid]",
|
831
|
+
0x23ac => "\\[rk]",
|
832
|
+
#0x23ad => "\\[bracerightbt]",
|
833
|
+
0x23ad => "\\[rb]",
|
834
|
+
0x23af => "\\[an]",
|
835
|
+
0x2502 => "\\[br]",
|
836
|
+
0x25a1 => "\\[sq]",
|
837
|
+
0x25ca => "\\[lz]",
|
838
|
+
0x25cb => "\\[ci]",
|
839
|
+
0x261c => "\\[lh]",
|
840
|
+
0x261e => "\\[rh]",
|
841
|
+
0x2660 => "\\[SP]",
|
842
|
+
0x2663 => "\\[CL]",
|
843
|
+
0x2665 => "\\[HE]",
|
844
|
+
0x2666 => "\\[DI]",
|
845
|
+
0x2713 => "\\[OK]",
|
846
|
+
0x27e8 => "\\[la]",
|
847
|
+
0x27e9 => "\\[ra]",
|
848
|
+
}.freeze
|
849
|
+
|
850
|
+
end
|
851
|
+
end
|