md2man 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
+ '&quot;' => 0x0022,
252
+ '&amp;' => 0x0026,
253
+ '&apos;' => 0x0027,
254
+ '&lt;' => 0x003c,
255
+ '&gt;' => 0x003e,
256
+ '&nbsp;' => 0x00a0,
257
+ '&iexcl;' => 0x00a1,
258
+ '&cent;' => 0x00a2,
259
+ '&pound;' => 0x00a3,
260
+ '&curren;' => 0x00a4,
261
+ '&yen;' => 0x00a5,
262
+ '&brvbar;' => 0x00a6,
263
+ '&sect;' => 0x00a7,
264
+ '&uml;' => 0x00a8,
265
+ '&copy;' => 0x00a9,
266
+ '&ordf;' => 0x00aa,
267
+ '&laquo;' => 0x00ab,
268
+ '&not;' => 0x00ac,
269
+ '&shy;' => 0x00ad,
270
+ '&reg;' => 0x00ae,
271
+ '&macr;' => 0x00af,
272
+ '&deg;' => 0x00b0,
273
+ '&plusmn;' => 0x00b1,
274
+ '&sup2;' => 0x00b2,
275
+ '&sup3;' => 0x00b3,
276
+ '&acute;' => 0x00b4,
277
+ '&micro;' => 0x00b5,
278
+ '&para;' => 0x00b6,
279
+ '&middot;' => 0x00b7,
280
+ '&cedil;' => 0x00b8,
281
+ '&sup1;' => 0x00b9,
282
+ '&ordm;' => 0x00ba,
283
+ '&raquo;' => 0x00bb,
284
+ '&frac14;' => 0x00bc,
285
+ '&frac12;' => 0x00bd,
286
+ '&frac34;' => 0x00be,
287
+ '&iquest;' => 0x00bf,
288
+ '&Agrave;' => 0x00c0,
289
+ '&Aacute;' => 0x00c1,
290
+ '&Acirc;' => 0x00c2,
291
+ '&Atilde;' => 0x00c3,
292
+ '&Auml;' => 0x00c4,
293
+ '&Aring;' => 0x00c5,
294
+ '&AElig;' => 0x00c6,
295
+ '&Ccedil;' => 0x00c7,
296
+ '&Egrave;' => 0x00c8,
297
+ '&Eacute;' => 0x00c9,
298
+ '&Ecirc;' => 0x00ca,
299
+ '&Euml;' => 0x00cb,
300
+ '&Igrave;' => 0x00cc,
301
+ '&Iacute;' => 0x00cd,
302
+ '&Icirc;' => 0x00ce,
303
+ '&Iuml;' => 0x00cf,
304
+ '&ETH;' => 0x00d0,
305
+ '&Ntilde;' => 0x00d1,
306
+ '&Ograve;' => 0x00d2,
307
+ '&Oacute;' => 0x00d3,
308
+ '&Ocirc;' => 0x00d4,
309
+ '&Otilde;' => 0x00d5,
310
+ '&Ouml;' => 0x00d6,
311
+ '&times;' => 0x00d7,
312
+ '&Oslash;' => 0x00d8,
313
+ '&Ugrave;' => 0x00d9,
314
+ '&Uacute;' => 0x00da,
315
+ '&Ucirc;' => 0x00db,
316
+ '&Uuml;' => 0x00dc,
317
+ '&Yacute;' => 0x00dd,
318
+ '&THORN;' => 0x00de,
319
+ '&szlig;' => 0x00df,
320
+ '&agrave;' => 0x00e0,
321
+ '&aacute;' => 0x00e1,
322
+ '&acirc;' => 0x00e2,
323
+ '&atilde;' => 0x00e3,
324
+ '&auml;' => 0x00e4,
325
+ '&aring;' => 0x00e5,
326
+ '&aelig;' => 0x00e6,
327
+ '&ccedil;' => 0x00e7,
328
+ '&egrave;' => 0x00e8,
329
+ '&eacute;' => 0x00e9,
330
+ '&ecirc;' => 0x00ea,
331
+ '&euml;' => 0x00eb,
332
+ '&igrave;' => 0x00ec,
333
+ '&iacute;' => 0x00ed,
334
+ '&icirc;' => 0x00ee,
335
+ '&iuml;' => 0x00ef,
336
+ '&eth;' => 0x00f0,
337
+ '&ntilde;' => 0x00f1,
338
+ '&ograve;' => 0x00f2,
339
+ '&oacute;' => 0x00f3,
340
+ '&ocirc;' => 0x00f4,
341
+ '&otilde;' => 0x00f5,
342
+ '&ouml;' => 0x00f6,
343
+ '&divide;' => 0x00f7,
344
+ '&oslash;' => 0x00f8,
345
+ '&ugrave;' => 0x00f9,
346
+ '&uacute;' => 0x00fa,
347
+ '&ucirc;' => 0x00fb,
348
+ '&uuml;' => 0x00fc,
349
+ '&yacute;' => 0x00fd,
350
+ '&thorn;' => 0x00fe,
351
+ '&yuml;' => 0x00ff,
352
+ '&OElig;' => 0x0152,
353
+ '&oelig;' => 0x0153,
354
+ '&Scaron;' => 0x0160,
355
+ '&scaron;' => 0x0161,
356
+ '&Yuml;' => 0x0178,
357
+ '&fnof;' => 0x0192,
358
+ '&circ;' => 0x02c6,
359
+ '&tilde;' => 0x02dc,
360
+ '&Alpha;' => 0x0391,
361
+ '&Beta;' => 0x0392,
362
+ '&Gamma;' => 0x0393,
363
+ '&Delta;' => 0x0394,
364
+ '&Epsilon;' => 0x0395,
365
+ '&Zeta;' => 0x0396,
366
+ '&Eta;' => 0x0397,
367
+ '&Theta;' => 0x0398,
368
+ '&Iota;' => 0x0399,
369
+ '&Kappa;' => 0x039a,
370
+ '&Lambda;' => 0x039b,
371
+ '&Mu;' => 0x039c,
372
+ '&Nu;' => 0x039d,
373
+ '&Xi;' => 0x039e,
374
+ '&Omicron;' => 0x039f,
375
+ '&Pi;' => 0x03a0,
376
+ '&Rho;' => 0x03a1,
377
+ '&Sigma;' => 0x03a3,
378
+ '&Tau;' => 0x03a4,
379
+ '&Upsilon;' => 0x03a5,
380
+ '&Phi;' => 0x03a6,
381
+ '&Chi;' => 0x03a7,
382
+ '&Psi;' => 0x03a8,
383
+ '&Omega;' => 0x03a9,
384
+ '&alpha;' => 0x03b1,
385
+ '&beta;' => 0x03b2,
386
+ '&gamma;' => 0x03b3,
387
+ '&delta;' => 0x03b4,
388
+ '&epsilon;' => 0x03b5,
389
+ '&zeta;' => 0x03b6,
390
+ '&eta;' => 0x03b7,
391
+ '&theta;' => 0x03b8,
392
+ '&iota;' => 0x03b9,
393
+ '&kappa;' => 0x03ba,
394
+ '&lambda;' => 0x03bb,
395
+ '&mu;' => 0x03bc,
396
+ '&nu;' => 0x03bd,
397
+ '&xi;' => 0x03be,
398
+ '&omicron;' => 0x03bf,
399
+ '&pi;' => 0x03c0,
400
+ '&rho;' => 0x03c1,
401
+ '&sigmaf;' => 0x03c2,
402
+ '&sigma;' => 0x03c3,
403
+ '&tau;' => 0x03c4,
404
+ '&upsilon;' => 0x03c5,
405
+ '&phi;' => 0x03c6,
406
+ '&chi;' => 0x03c7,
407
+ '&psi;' => 0x03c8,
408
+ '&omega;' => 0x03c9,
409
+ '&thetasym;' => 0x03d1,
410
+ '&upsih;' => 0x03d2,
411
+ '&piv;' => 0x03d6,
412
+ '&ensp;' => 0x2002,
413
+ '&emsp;' => 0x2003,
414
+ '&thinsp;' => 0x2009,
415
+ '&zwnj;' => 0x200c,
416
+ '&zwj;' => 0x200d,
417
+ '&lrm;' => 0x200e,
418
+ '&rlm;' => 0x200f,
419
+ '&ndash;' => 0x2013,
420
+ '&mdash;' => 0x2014,
421
+ '&lsquo;' => 0x2018,
422
+ '&rsquo;' => 0x2019,
423
+ '&sbquo;' => 0x201a,
424
+ '&ldquo;' => 0x201c,
425
+ '&rdquo;' => 0x201d,
426
+ '&bdquo;' => 0x201e,
427
+ '&dagger;' => 0x2020,
428
+ '&Dagger;' => 0x2021,
429
+ '&bull;' => 0x2022,
430
+ '&hellip;' => 0x2026,
431
+ '&permil;' => 0x2030,
432
+ '&prime;' => 0x2032,
433
+ '&Prime;' => 0x2033,
434
+ '&lsaquo;' => 0x2039,
435
+ '&rsaquo;' => 0x203a,
436
+ '&oline;' => 0x203e,
437
+ '&frasl;' => 0x2044,
438
+ '&euro;' => 0x20ac,
439
+ '&image;' => 0x2111,
440
+ '&weierp;' => 0x2118,
441
+ '&real;' => 0x211c,
442
+ '&trade;' => 0x2122,
443
+ '&alefsym;' => 0x2135,
444
+ '&larr;' => 0x2190,
445
+ '&uarr;' => 0x2191,
446
+ '&rarr;' => 0x2192,
447
+ '&darr;' => 0x2193,
448
+ '&harr;' => 0x2194,
449
+ '&crarr;' => 0x21b5,
450
+ '&lArr;' => 0x21d0,
451
+ '&uArr;' => 0x21d1,
452
+ '&rArr;' => 0x21d2,
453
+ '&dArr;' => 0x21d3,
454
+ '&hArr;' => 0x21d4,
455
+ '&forall;' => 0x2200,
456
+ '&part;' => 0x2202,
457
+ '&exist;' => 0x2203,
458
+ '&empty;' => 0x2205,
459
+ '&nabla;' => 0x2207,
460
+ '&isin;' => 0x2208,
461
+ '&notin;' => 0x2209,
462
+ '&ni;' => 0x220b,
463
+ '&prod;' => 0x220f,
464
+ '&sum;' => 0x2211,
465
+ '&minus;' => 0x2212,
466
+ '&lowast;' => 0x2217,
467
+ '&radic;' => 0x221a,
468
+ '&prop;' => 0x221d,
469
+ '&infin;' => 0x221e,
470
+ '&ang;' => 0x2220,
471
+ '&and;' => 0x2227,
472
+ '&or;' => 0x2228,
473
+ '&cap;' => 0x2229,
474
+ '&cup;' => 0x222a,
475
+ '&int;' => 0x222b,
476
+ '&there4;' => 0x2234,
477
+ '&sim;' => 0x223c,
478
+ '&cong;' => 0x2245,
479
+ '&asymp;' => 0x2248,
480
+ '&ne;' => 0x2260,
481
+ '&equiv;' => 0x2261,
482
+ '&le;' => 0x2264,
483
+ '&ge;' => 0x2265,
484
+ '&sub;' => 0x2282,
485
+ '&sup;' => 0x2283,
486
+ '&nsub;' => 0x2284,
487
+ '&sube;' => 0x2286,
488
+ '&supe;' => 0x2287,
489
+ '&oplus;' => 0x2295,
490
+ '&otimes;' => 0x2297,
491
+ '&perp;' => 0x22a5,
492
+ '&sdot;' => 0x22c5,
493
+ '&lceil;' => 0x2308,
494
+ '&rceil;' => 0x2309,
495
+ '&lfloor;' => 0x230a,
496
+ '&rfloor;' => 0x230b,
497
+ '&lang;' => 0x2329,
498
+ '&rang;' => 0x232a,
499
+ '&loz;' => 0x25ca,
500
+ '&spades;' => 0x2660,
501
+ '&clubs;' => 0x2663,
502
+ '&hearts;' => 0x2665,
503
+ '&diams;' => 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