New syntax-propertize functionality.
[emacs.git] / lisp / international / iso-cvt.el
blob8798a4894fbbe43eee5d05e41f6d9092dbf39b4d
1 ;;; iso-cvt.el --- translate ISO 8859-1 from/to various encodings -*- coding: iso-latin-1 -*-
2 ;; This file was formerly called gm-lingo.el.
4 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
5 ;; 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
7 ;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at>
8 ;; Keywords: tex, iso, latin, i18n
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;;; Commentary:
26 ;; This lisp code is a general framework for translating various
27 ;; representations of the same data.
28 ;; among other things it can be used to translate TeX, HTML, and compressed
29 ;; files to ISO 8859-1. It can also be used to translate different charsets
30 ;; such as IBM PC, Macintosh or HP Roman8.
31 ;; Note that many translations use the GNU recode tool to do the actual
32 ;; conversion. So you might want to install that tool to get the full
33 ;; benefit of iso-cvt.el
35 ; TO DO:
36 ; Cover more cases for translation. (There is an infinite number of ways to
37 ; represent accented characters in TeX)
39 ;; SEE ALSO:
40 ; If you are interested in questions related to using the ISO 8859-1
41 ; characters set (configuring emacs, Unix, etc. to use ISO), then you
42 ; can get the ISO 8859-1 FAQ via anonymous ftp from
43 ; ftp.vlsivie.tuwien.ac.at in /pub/8bit/FAQ-ISO-8859-1
45 ;;; Code:
47 (defvar iso-spanish-trans-tab
49 ("~n" "ñ")
50 ("\([a-zA-Z]\)#" "\\1ñ")
51 ("~N" "Ñ")
52 ("\\([-a-zA-Z\"`]\\)\"u" "\\1ü")
53 ("\\([-a-zA-Z\"`]\\)\"U" "\\1Ü")
54 ("\\([-a-zA-Z]\\)'o" "\\1ó")
55 ("\\([-a-zA-Z]\\)'O" "\\Ó")
56 ("\\([-a-zA-Z]\\)'e" "\\1é")
57 ("\\([-a-zA-Z]\\)'E" "\\1É")
58 ("\\([-a-zA-Z]\\)'a" "\\1á")
59 ("\\([-a-zA-Z]\\)'A" "\\1A")
60 ("\\([-a-zA-Z]\\)'i" "\\1í")
61 ("\\([-a-zA-Z]\\)'I" "\\1Í")
63 "Spanish translation table.")
65 (defun iso-translate-conventions (from to trans-tab)
66 "Translate between FROM and TO using the translation table TRANS-TAB."
67 (save-excursion
68 (save-restriction
69 (narrow-to-region from to)
70 (goto-char from)
71 (let ((work-tab trans-tab)
72 (buffer-read-only nil)
73 (case-fold-search nil))
74 (while work-tab
75 (save-excursion
76 (let ((trans-this (car work-tab)))
77 (while (re-search-forward (car trans-this) nil t)
78 (replace-match (car (cdr trans-this)) t nil)))
79 (setq work-tab (cdr work-tab)))))
80 (point-max))))
82 ;;;###autoload
83 (defun iso-spanish (from to &optional buffer)
84 "Translate net conventions for Spanish to ISO 8859-1.
85 Translate the region between FROM and TO using the table
86 `iso-spanish-trans-tab'.
87 Optional arg BUFFER is ignored (for use in `format-alist')."
88 (interactive "*r")
89 (iso-translate-conventions from to iso-spanish-trans-tab))
91 (defvar iso-aggressive-german-trans-tab
93 ("\"a" "ä")
94 ("\"A" "Ä")
95 ("\"o" "ö")
96 ("\"O" "Ö")
97 ("\"u" "ü")
98 ("\"U" "Ü")
99 ("\"s" "ß")
100 ("\\\\3" "ß")
102 "German translation table.
103 This table uses an aggressive translation approach
104 and may erroneously translate too much.")
106 (defvar iso-conservative-german-trans-tab
108 ("\\([-a-zA-Z\"`]\\)\"a" "\\1ä")
109 ("\\([-a-zA-Z\"`]\\)\"A" "\\1Ä")
110 ("\\([-a-zA-Z\"`]\\)\"o" "\\1ö")
111 ("\\([-a-zA-Z\"`]\\)\"O" "\\1Ö")
112 ("\\([-a-zA-Z\"`]\\)\"u" "\\1ü")
113 ("\\([-a-zA-Z\"`]\\)\"U" "\\1Ü")
114 ("\\([-a-zA-Z\"`]\\)\"s" "\\1ß")
115 ("\\([-a-zA-Z\"`]\\)\\\\3" "\\1ß")
117 "German translation table.
118 This table uses a conservative translation approach
119 and may translate too little.")
121 (defvar iso-german-trans-tab iso-aggressive-german-trans-tab
122 "Currently active translation table for German.")
124 ;;;###autoload
125 (defun iso-german (from to &optional buffer)
126 "Translate net conventions for German to ISO 8859-1.
127 Translate the region FROM and TO using the table
128 `iso-german-trans-tab'.
129 Optional arg BUFFER is ignored (for use in `format-alist')."
130 (interactive "*r")
131 (iso-translate-conventions from to iso-german-trans-tab))
133 (defvar iso-iso2tex-trans-tab
135 ("ä" "{\\\\\"a}")
136 ("à" "{\\\\`a}")
137 ("á" "{\\\\'a}")
138 ("ã" "{\\\\~a}")
139 ("â" "{\\\\^a}")
140 ("ë" "{\\\\\"e}")
141 ("è" "{\\\\`e}")
142 ("é" "{\\\\'e}")
143 ("ê" "{\\\\^e}")
144 ("ï" "{\\\\\"\\\\i}")
145 ("ì" "{\\\\`\\\\i}")
146 ("í" "{\\\\'\\\\i}")
147 ("î" "{\\\\^\\\\i}")
148 ("ö" "{\\\\\"o}")
149 ("ò" "{\\\\`o}")
150 ("ó" "{\\\\'o}")
151 ("õ" "{\\\\~o}")
152 ("ô" "{\\\\^o}")
153 ("ü" "{\\\\\"u}")
154 ("ù" "{\\\\`u}")
155 ("ú" "{\\\\'u}")
156 ("û" "{\\\\^u}")
157 ("Ä" "{\\\\\"A}")
158 ("À" "{\\\\`A}")
159 ("Á" "{\\\\'A}")
160 ("Ã" "{\\\\~A}")
161 ("Â" "{\\\\^A}")
162 ("Ë" "{\\\\\"E}")
163 ("È" "{\\\\`E}")
164 ("É" "{\\\\'E}")
165 ("Ê" "{\\\\^E}")
166 ("Ï" "{\\\\\"I}")
167 ("Ì" "{\\\\`I}")
168 ("Í" "{\\\\'I}")
169 ("Î" "{\\\\^I}")
170 ("Ö" "{\\\\\"O}")
171 ("Ò" "{\\\\`O}")
172 ("Ó" "{\\\\'O}")
173 ("Õ" "{\\\\~O}")
174 ("Ô" "{\\\\^O}")
175 ("Ü" "{\\\\\"U}")
176 ("Ù" "{\\\\`U}")
177 ("Ú" "{\\\\'U}")
178 ("Û" "{\\\\^U}")
179 ("ñ" "{\\\\~n}")
180 ("Ñ" "{\\\\~N}")
181 ("ç" "{\\\\c c}")
182 ("Ç" "{\\\\c C}")
183 ("ß" "{\\\\ss}")
184 ("\306" "{\\\\AE}")
185 ("\346" "{\\\\ae}")
186 ("\305" "{\\\\AA}")
187 ("\345" "{\\\\aa}")
188 ("\251" "{\\\\copyright}")
189 ("£" "{\\\\pounds}")
190 ("¶" "{\\\\P}")
191 ("§" "{\\\\S}")
192 ("¿" "{?`}")
193 ("¡" "{!`}")
195 "Translation table for translating ISO 8859-1 characters to TeX sequences.")
197 ;;;###autoload
198 (defun iso-iso2tex (from to &optional buffer)
199 "Translate ISO 8859-1 characters to TeX sequences.
200 Translate the region between FROM and TO using the table
201 `iso-iso2tex-trans-tab'.
202 Optional arg BUFFER is ignored (for use in `format-alist')."
203 (interactive "*r")
204 (iso-translate-conventions from to iso-iso2tex-trans-tab))
206 (defvar iso-tex2iso-trans-tab
208 ("{\\\\\"a}" "ä")
209 ("{\\\\`a}" "à")
210 ("{\\\\'a}" "á")
211 ("{\\\\~a}" "ã")
212 ("{\\\\^a}" "â")
213 ("{\\\\\"e}" "ë")
214 ("{\\\\`e}" "è")
215 ("{\\\\'e}" "é")
216 ("{\\\\^e}" "ê")
217 ("{\\\\\"\\\\i}" "ï")
218 ("{\\\\`\\\\i}" "ì")
219 ("{\\\\'\\\\i}" "í")
220 ("{\\\\^\\\\i}" "î")
221 ("{\\\\\"i}" "ï")
222 ("{\\\\`i}" "ì")
223 ("{\\\\'i}" "í")
224 ("{\\\\^i}" "î")
225 ("{\\\\\"o}" "ö")
226 ("{\\\\`o}" "ò")
227 ("{\\\\'o}" "ó")
228 ("{\\\\~o}" "õ")
229 ("{\\\\^o}" "ô")
230 ("{\\\\\"u}" "ü")
231 ("{\\\\`u}" "ù")
232 ("{\\\\'u}" "ú")
233 ("{\\\\^u}" "û")
234 ("{\\\\\"A}" "Ä")
235 ("{\\\\`A}" "À")
236 ("{\\\\'A}" "Á")
237 ("{\\\\~A}" "Ã")
238 ("{\\\\^A}" "Â")
239 ("{\\\\\"E}" "Ë")
240 ("{\\\\`E}" "È")
241 ("{\\\\'E}" "É")
242 ("{\\\\^E}" "Ê")
243 ("{\\\\\"I}" "Ï")
244 ("{\\\\`I}" "Ì")
245 ("{\\\\'I}" "Í")
246 ("{\\\\^I}" "Î")
247 ("{\\\\\"O}" "Ö")
248 ("{\\\\`O}" "Ò")
249 ("{\\\\'O}" "Ó")
250 ("{\\\\~O}" "Õ")
251 ("{\\\\^O}" "Ô")
252 ("{\\\\\"U}" "Ü")
253 ("{\\\\`U}" "Ù")
254 ("{\\\\'U}" "Ú")
255 ("{\\\\^U}" "Û")
256 ("{\\\\~n}" "ñ")
257 ("{\\\\~N}" "Ñ")
258 ("{\\\\c c}" "ç")
259 ("{\\\\c C}" "Ç")
260 ("\\\\\"a" "ä")
261 ("\\\\`a" "à")
262 ("\\\\'a" "á")
263 ("\\\\~a" "ã")
264 ("\\\\^a" "â")
265 ("\\\\\"e" "ë")
266 ("\\\\`e" "è")
267 ("\\\\'e" "é")
268 ("\\\\^e" "ê")
269 ;; Discard spaces and/or one EOF after macro \i.
270 ;; Converting it back will use braces.
271 ("\\\\\"\\\\i *\n\n" \n\n")
272 ("\\\\\"\\\\i *\n?" "ï")
273 ("\\\\`\\\\i *\n\n" \n\n")
274 ("\\\\`\\\\i *\n?" "ì")
275 ("\\\\'\\\\i *\n\n" \n\n")
276 ("\\\\'\\\\i *\n?" "í")
277 ("\\\\^\\\\i *\n\n" \n\n")
278 ("\\\\^\\\\i *\n?" "î")
279 ("\\\\\"i" "ï")
280 ("\\\\`i" "ì")
281 ("\\\\'i" "í")
282 ("\\\\^i" "î")
283 ("\\\\\"o" "ö")
284 ("\\\\`o" "ò")
285 ("\\\\'o" "ó")
286 ("\\\\~o" "õ")
287 ("\\\\^o" "ô")
288 ("\\\\\"u" "ü")
289 ("\\\\`u" "ù")
290 ("\\\\'u" "ú")
291 ("\\\\^u" "û")
292 ("\\\\\"A" "Ä")
293 ("\\\\`A" "À")
294 ("\\\\'A" "Á")
295 ("\\\\~A" "Ã")
296 ("\\\\^A" "Â")
297 ("\\\\\"E" "Ë")
298 ("\\\\`E" "È")
299 ("\\\\'E" "É")
300 ("\\\\^E" "Ê")
301 ("\\\\\"I" "Ï")
302 ("\\\\`I" "Ì")
303 ("\\\\'I" "Í")
304 ("\\\\^I" "Î")
305 ("\\\\\"O" "Ö")
306 ("\\\\`O" "Ò")
307 ("\\\\'O" "Ó")
308 ("\\\\~O" "Õ")
309 ("\\\\^O" "Ô")
310 ("\\\\\"U" "Ü")
311 ("\\\\`U" "Ù")
312 ("\\\\'U" "Ú")
313 ("\\\\^U" "Û")
314 ("\\\\~n" "ñ")
315 ("\\\\~N" "Ñ")
316 ("\\\\\"{a}" "ä")
317 ("\\\\`{a}" "à")
318 ("\\\\'{a}" "á")
319 ("\\\\~{a}" "ã")
320 ("\\\\^{a}" "â")
321 ("\\\\\"{e}" "ë")
322 ("\\\\`{e}" "è")
323 ("\\\\'{e}" "é")
324 ("\\\\^{e}" "ê")
325 ("\\\\\"{\\\\i}" "ï")
326 ("\\\\`{\\\\i}" "ì")
327 ("\\\\'{\\\\i}" "í")
328 ("\\\\^{\\\\i}" "î")
329 ("\\\\\"{i}" "ï")
330 ("\\\\`{i}" "ì")
331 ("\\\\'{i}" "í")
332 ("\\\\^{i}" "î")
333 ("\\\\\"{o}" "ö")
334 ("\\\\`{o}" "ò")
335 ("\\\\'{o}" "ó")
336 ("\\\\~{o}" "õ")
337 ("\\\\^{o}" "ô")
338 ("\\\\\"{u}" "ü")
339 ("\\\\`{u}" "ù")
340 ("\\\\'{u}" "ú")
341 ("\\\\^{u}" "û")
342 ("\\\\\"{A}" "Ä")
343 ("\\\\`{A}" "À")
344 ("\\\\'{A}" "Á")
345 ("\\\\~{A}" "Ã")
346 ("\\\\^{A}" "Â")
347 ("\\\\\"{E}" "Ë")
348 ("\\\\`{E}" "È")
349 ("\\\\'{E}" "É")
350 ("\\\\^{E}" "Ê")
351 ("\\\\\"{I}" "Ï")
352 ("\\\\`{I}" "Ì")
353 ("\\\\'{I}" "Í")
354 ("\\\\^{I}" "Î")
355 ("\\\\\"{O}" "Ö")
356 ("\\\\`{O}" "Ò")
357 ("\\\\'{O}" "Ó")
358 ("\\\\~{O}" "Õ")
359 ("\\\\^{O}" "Ô")
360 ("\\\\\"{U}" "Ü")
361 ("\\\\`{U}" "Ù")
362 ("\\\\'{U}" "Ú")
363 ("\\\\^{U}" "Û")
364 ("\\\\~{n}" "ñ")
365 ("\\\\~{N}" "Ñ")
366 ("\\\\c{c}" "ç")
367 ("\\\\c{C}" "Ç")
368 ("{\\\\ss}" "ß")
369 ("{\\\\AE}" "\306")
370 ("{\\\\ae}" "\346")
371 ("{\\\\AA}" "\305")
372 ("{\\\\aa}" "\345")
373 ("{\\\\copyright}" "\251")
374 ("\\\\copyright{}" "\251")
375 ("{\\\\pounds}" "£" )
376 ("{\\\\P}" "¶" )
377 ("{\\\\S}" "§" )
378 ("\\\\pounds{}" "£" )
379 ("\\\\P{}" "¶" )
380 ("\\\\S{}" "§" )
381 ("{\\?`}" "¿")
382 ("{!`}" "¡")
383 ("\\?`" "¿")
384 ("!`" "¡")
386 "Translation table for translating TeX sequences to ISO 8859-1 characters.
387 This table is not exhaustive (and due to TeX's power can never be).
388 It only contains commonly used sequences.")
390 ;;;###autoload
391 (defun iso-tex2iso (from to &optional buffer)
392 "Translate TeX sequences to ISO 8859-1 characters.
393 Translate the region between FROM and TO using the table
394 `iso-tex2iso-trans-tab'.
395 Optional arg BUFFER is ignored (for use in `format-alist')."
396 (interactive "*r")
397 (iso-translate-conventions from to iso-tex2iso-trans-tab))
399 (defvar iso-gtex2iso-trans-tab
401 ("{\\\\\"a}" "ä")
402 ("{\\\\`a}" "à")
403 ("{\\\\'a}" "á")
404 ("{\\\\~a}" "ã")
405 ("{\\\\^a}" "â")
406 ("{\\\\\"e}" "ë")
407 ("{\\\\`e}" "è")
408 ("{\\\\'e}" "é")
409 ("{\\\\^e}" "ê")
410 ("{\\\\\"\\\\i}" "ï")
411 ("{\\\\`\\\\i}" "ì")
412 ("{\\\\'\\\\i}" "í")
413 ("{\\\\^\\\\i}" "î")
414 ("{\\\\\"i}" "ï")
415 ("{\\\\`i}" "ì")
416 ("{\\\\'i}" "í")
417 ("{\\\\^i}" "î")
418 ("{\\\\\"o}" "ö")
419 ("{\\\\`o}" "ò")
420 ("{\\\\'o}" "ó")
421 ("{\\\\~o}" "õ")
422 ("{\\\\^o}" "ô")
423 ("{\\\\\"u}" "ü")
424 ("{\\\\`u}" "ù")
425 ("{\\\\'u}" "ú")
426 ("{\\\\^u}" "û")
427 ("{\\\\\"A}" "Ä")
428 ("{\\\\`A}" "À")
429 ("{\\\\'A}" "Á")
430 ("{\\\\~A}" "Ã")
431 ("{\\\\^A}" "Â")
432 ("{\\\\\"E}" "Ë")
433 ("{\\\\`E}" "È")
434 ("{\\\\'E}" "É")
435 ("{\\\\^E}" "Ê")
436 ("{\\\\\"I}" "Ï")
437 ("{\\\\`I}" "Ì")
438 ("{\\\\'I}" "Í")
439 ("{\\\\^I}" "Î")
440 ("{\\\\\"O}" "Ö")
441 ("{\\\\`O}" "Ò")
442 ("{\\\\'O}" "Ó")
443 ("{\\\\~O}" "Õ")
444 ("{\\\\^O}" "Ô")
445 ("{\\\\\"U}" "Ü")
446 ("{\\\\`U}" "Ù")
447 ("{\\\\'U}" "Ú")
448 ("{\\\\^U}" "Û")
449 ("{\\\\~n}" "ñ")
450 ("{\\\\~N}" "Ñ")
451 ("{\\\\c c}" "ç")
452 ("{\\\\c C}" "Ç")
453 ("\\\\\"a" "ä")
454 ("\\\\`a" "à")
455 ("\\\\'a" "á")
456 ("\\\\~a" "ã")
457 ("\\\\^a" "â")
458 ("\\\\\"e" "ë")
459 ("\\\\`e" "è")
460 ("\\\\'e" "é")
461 ("\\\\^e" "ê")
462 ("\\\\\"\\\\i" "ï")
463 ("\\\\`\\\\i" "ì")
464 ("\\\\'\\\\i" "í")
465 ("\\\\^\\\\i" "î")
466 ("\\\\\"i" "ï")
467 ("\\\\`i" "ì")
468 ("\\\\'i" "í")
469 ("\\\\^i" "î")
470 ("\\\\\"o" "ö")
471 ("\\\\`o" "ò")
472 ("\\\\'o" "ó")
473 ("\\\\~o" "õ")
474 ("\\\\^o" "ô")
475 ("\\\\\"u" "ü")
476 ("\\\\`u" "ù")
477 ("\\\\'u" "ú")
478 ("\\\\^u" "û")
479 ("\\\\\"A" "Ä")
480 ("\\\\`A" "À")
481 ("\\\\'A" "Á")
482 ("\\\\~A" "Ã")
483 ("\\\\^A" "Â")
484 ("\\\\\"E" "Ë")
485 ("\\\\`E" "È")
486 ("\\\\'E" "É")
487 ("\\\\^E" "Ê")
488 ("\\\\\"I" "Ï")
489 ("\\\\`I" "Ì")
490 ("\\\\'I" "Í")
491 ("\\\\^I" "Î")
492 ("\\\\\"O" "Ö")
493 ("\\\\`O" "Ò")
494 ("\\\\'O" "Ó")
495 ("\\\\~O" "Õ")
496 ("\\\\^O" "Ô")
497 ("\\\\\"U" "Ü")
498 ("\\\\`U" "Ù")
499 ("\\\\'U" "Ú")
500 ("\\\\^U" "Û")
501 ("\\\\~n" "ñ")
502 ("\\\\~N" "Ñ")
503 ("\\\\\"{a}" "ä")
504 ("\\\\`{a}" "à")
505 ("\\\\'{a}" "á")
506 ("\\\\~{a}" "ã")
507 ("\\\\^{a}" "â")
508 ("\\\\\"{e}" "ë")
509 ("\\\\`{e}" "è")
510 ("\\\\'{e}" "é")
511 ("\\\\^{e}" "ê")
512 ("\\\\\"{\\\\i}" "ï")
513 ("\\\\`{\\\\i}" "ì")
514 ("\\\\'{\\\\i}" "í")
515 ("\\\\^{\\\\i}" "î")
516 ("\\\\\"{i}" "ï")
517 ("\\\\`{i}" "ì")
518 ("\\\\'{i}" "í")
519 ("\\\\^{i}" "î")
520 ("\\\\\"{o}" "ö")
521 ("\\\\`{o}" "ò")
522 ("\\\\'{o}" "ó")
523 ("\\\\~{o}" "õ")
524 ("\\\\^{o}" "ô")
525 ("\\\\\"{u}" "ü")
526 ("\\\\`{u}" "ù")
527 ("\\\\'{u}" "ú")
528 ("\\\\^{u}" "û")
529 ("\\\\\"{A}" "Ä")
530 ("\\\\`{A}" "À")
531 ("\\\\'{A}" "Á")
532 ("\\\\~{A}" "Ã")
533 ("\\\\^{A}" "Â")
534 ("\\\\\"{E}" "Ë")
535 ("\\\\`{E}" "È")
536 ("\\\\'{E}" "É")
537 ("\\\\^{E}" "Ê")
538 ("\\\\\"{I}" "Ï")
539 ("\\\\`{I}" "Ì")
540 ("\\\\'{I}" "Í")
541 ("\\\\^{I}" "Î")
542 ("\\\\\"{O}" "Ö")
543 ("\\\\`{O}" "Ò")
544 ("\\\\'{O}" "Ó")
545 ("\\\\~{O}" "Õ")
546 ("\\\\^{O}" "Ô")
547 ("\\\\\"{U}" "Ü")
548 ("\\\\`{U}" "Ù")
549 ("\\\\'{U}" "Ú")
550 ("\\\\^{U}" "Û")
551 ("\\\\~{n}" "ñ")
552 ("\\\\~{N}" "Ñ")
553 ("\\\\c{c}" "ç")
554 ("\\\\c{C}" "Ç")
555 ("{\\\\ss}" "ß")
556 ("{\\\\AE}" "\306")
557 ("{\\\\ae}" "\346")
558 ("{\\\\AA}" "\305")
559 ("{\\\\aa}" "\345")
560 ("{\\\\copyright}" "\251")
561 ("\\\\copyright{}" "\251")
562 ("{\\\\pounds}" "£" )
563 ("{\\\\P}" "¶" )
564 ("{\\\\S}" "§" )
565 ("\\\\pounds{}" "£" )
566 ("\\\\P{}" "¶" )
567 ("\\\\S{}" "§" )
568 ("?`" "¿")
569 ("!`" "¡")
570 ("{?`}" "¿")
571 ("{!`}" "¡")
572 ("\"a" "ä")
573 ("\"A" "Ä")
574 ("\"o" "ö")
575 ("\"O" "Ö")
576 ("\"u" "ü")
577 ("\"U" "Ü")
578 ("\"s" "ß")
579 ("\\\\3" "ß")
581 "Translation table for translating German TeX sequences to ISO 8859-1.
582 This table is not exhaustive (and due to TeX's power can never be).
583 It only contains commonly used sequences.")
585 (defvar iso-iso2gtex-trans-tab
587 ("ä" "\"a")
588 ("à" "{\\\\`a}")
589 ("á" "{\\\\'a}")
590 ("ã" "{\\\\~a}")
591 ("â" "{\\\\^a}")
592 ("ë" "{\\\\\"e}")
593 ("è" "{\\\\`e}")
594 ("é" "{\\\\'e}")
595 ("ê" "{\\\\^e}")
596 ("ï" "{\\\\\"\\\\i}")
597 ("ì" "{\\\\`\\\\i}")
598 ("í" "{\\\\'\\\\i}")
599 ("î" "{\\\\^\\\\i}")
600 ("ö" "\"o")
601 ("ò" "{\\\\`o}")
602 ("ó" "{\\\\'o}")
603 ("õ" "{\\\\~o}")
604 ("ô" "{\\\\^o}")
605 ("ü" "\"u")
606 ("ù" "{\\\\`u}")
607 ("ú" "{\\\\'u}")
608 ("û" "{\\\\^u}")
609 ("Ä" "\"A")
610 ("À" "{\\\\`A}")
611 ("Á" "{\\\\'A}")
612 ("Ã" "{\\\\~A}")
613 ("Â" "{\\\\^A}")
614 ("Ë" "{\\\\\"E}")
615 ("È" "{\\\\`E}")
616 ("É" "{\\\\'E}")
617 ("Ê" "{\\\\^E}")
618 ("Ï" "{\\\\\"I}")
619 ("Ì" "{\\\\`I}")
620 ("Í" "{\\\\'I}")
621 ("Î" "{\\\\^I}")
622 ("Ö" "\"O")
623 ("Ò" "{\\\\`O}")
624 ("Ó" "{\\\\'O}")
625 ("Õ" "{\\\\~O}")
626 ("Ô" "{\\\\^O}")
627 ("Ü" "\"U")
628 ("Ù" "{\\\\`U}")
629 ("Ú" "{\\\\'U}")
630 ("Û" "{\\\\^U}")
631 ("ñ" "{\\\\~n}")
632 ("Ñ" "{\\\\~N}")
633 ("ç" "{\\\\c c}")
634 ("Ç" "{\\\\c C}")
635 ("ß" "\"s")
636 ("\306" "{\\\\AE}")
637 ("\346" "{\\\\ae}")
638 ("\305" "{\\\\AA}")
639 ("\345" "{\\\\aa}")
640 ("\251" "{\\\\copyright}")
641 ("£" "{\\\\pounds}")
642 ("¶" "{\\\\P}")
643 ("§" "{\\\\S}")
644 ("¿" "{?`}")
645 ("¡" "{!`}")
647 "Translation table for translating ISO 8859-1 characters to German TeX.")
649 ;;;###autoload
650 (defun iso-gtex2iso (from to &optional buffer)
651 "Translate German TeX sequences to ISO 8859-1 characters.
652 Translate the region between FROM and TO using the table
653 `iso-gtex2iso-trans-tab'.
654 Optional arg BUFFER is ignored (for use in `format-alist')."
655 (interactive "*r")
656 (iso-translate-conventions from to iso-gtex2iso-trans-tab))
658 ;;;###autoload
659 (defun iso-iso2gtex (from to &optional buffer)
660 "Translate ISO 8859-1 characters to German TeX sequences.
661 Translate the region between FROM and TO using the table
662 `iso-iso2gtex-trans-tab'.
663 Optional arg BUFFER is ignored (for use in `format-alist')."
664 (interactive "*r")
665 (iso-translate-conventions from to iso-iso2gtex-trans-tab))
667 (defvar iso-iso2duden-trans-tab
668 '(("ä" "ae")
669 ("Ä" "Ae")
670 ("ö" "oe")
671 ("Ö" "Oe")
672 ("ü" "ue")
673 ("Ü" "Ue")
674 ("ß" "ss"))
675 "Translation table for translating ISO 8859-1 characters to Duden sequences.")
677 ;;;###autoload
678 (defun iso-iso2duden (from to &optional buffer)
679 "Translate ISO 8859-1 characters to Duden sequences.
680 Translate the region between FROM and TO using the table
681 `iso-iso2duden-trans-tab'.
682 Optional arg BUFFER is ignored (for use in `format-alist')."
683 (interactive "*r")
684 (iso-translate-conventions from to iso-iso2duden-trans-tab))
686 (defvar iso-iso2sgml-trans-tab
687 '(("À" "&Agrave;")
688 ("Á" "&Aacute;")
689 ("Â" "&Acirc;")
690 ("Ã" "&Atilde;")
691 ("Ä" "&Auml;")
692 ("Å" "&Aring;")
693 ("Æ" "&AElig;")
694 ("Ç" "&Ccedil;")
695 ("È" "&Egrave;")
696 ("É" "&Eacute;")
697 ("Ê" "&Ecirc;")
698 ("Ë" "&Euml;")
699 ("Ì" "&Igrave;")
700 ("Í" "&Iacute;")
701 ("Î" "&Icirc;")
702 ("Ï" "&Iuml;")
703 ("Ð" "&ETH;")
704 ("Ñ" "&Ntilde;")
705 ("Ò" "&Ograve;")
706 ("Ó" "&Oacute;")
707 ("Ô" "&Ocirc;")
708 ("Õ" "&Otilde;")
709 ("Ö" "&Ouml;")
710 ("Ø" "&Oslash;")
711 ("Ù" "&Ugrave;")
712 ("Ú" "&Uacute;")
713 ("Û" "&Ucirc;")
714 ("Ü" "&Uuml;")
715 ("Ý" "&Yacute;")
716 ("Þ" "&THORN;")
717 ("ß" "&szlig;")
718 ("à" "&agrave;")
719 ("á" "&aacute;")
720 ("â" "&acirc;")
721 ("ã" "&atilde;")
722 ("ä" "&auml;")
723 ("å" "&aring;")
724 ("æ" "&aelig;")
725 ("ç" "&ccedil;")
726 ("è" "&egrave;")
727 ("é" "&eacute;")
728 ("ê" "&ecirc;")
729 ("ë" "&euml;")
730 ("ì" "&igrave;")
731 ("í" "&iacute;")
732 ("î" "&icirc;")
733 ("ï" "&iuml;")
734 ("ð" "&eth;")
735 ("ñ" "&ntilde;")
736 ("ò" "&ograve;")
737 ("ó" "&oacute;")
738 ("ô" "&ocirc;")
739 ("õ" "&otilde;")
740 ("ö" "&ouml;")
741 ("ø" "&oslash;")
742 ("ù" "&ugrave;")
743 ("ú" "&uacute;")
744 ("û" "&ucirc;")
745 ("ü" "&uuml;")
746 ("ý" "&yacute;")
747 ("þ" "&thorn;")
748 ("ÿ" "&yuml;")))
750 (defvar iso-sgml2iso-trans-tab
751 '(("&Agrave;" "À")
752 ("&Aacute;" "Á")
753 ("&Acirc;" "Â")
754 ("&Atilde;" "Ã")
755 ("&Auml;" "Ä")
756 ("&Aring;" "Å")
757 ("&AElig;" "Æ")
758 ("&Ccedil;" "Ç")
759 ("&Egrave;" "È")
760 ("&Eacute;" "É")
761 ("&Ecirc;" "Ê")
762 ("&Euml;" "Ë")
763 ("&Igrave;" "Ì")
764 ("&Iacute;" "Í")
765 ("&Icirc;" "Î")
766 ("&Iuml;" "Ï")
767 ("&ETH;" "Ð")
768 ("&Ntilde;" "Ñ")
769 ("&Ograve;" "Ò")
770 ("&Oacute;" "Ó")
771 ("&Ocirc;" "Ô")
772 ("&Otilde;" "Õ")
773 ("&Ouml;" "Ö")
774 ("&Oslash;" "Ø")
775 ("&Ugrave;" "Ù")
776 ("&Uacute;" "Ú")
777 ("&Ucirc;" "Û")
778 ("&Uuml;" "Ü")
779 ("&Yacute;" "Ý")
780 ("&THORN;" "Þ")
781 ("&szlig;" "ß")
782 ("&agrave;" "à")
783 ("&aacute;" "á")
784 ("&acirc;" "â")
785 ("&atilde;" "ã")
786 ("&auml;" "ä")
787 ("&aring;" "å")
788 ("&aelig;" "æ")
789 ("&ccedil;" "ç")
790 ("&egrave;" "è")
791 ("&eacute;" "é")
792 ("&ecirc;" "ê")
793 ("&euml;" "ë")
794 ("&igrave;" "ì")
795 ("&iacute;" "í")
796 ("&icirc;" "î")
797 ("&iuml;" "ï")
798 ("&eth;" "ð")
799 ("&ntilde;" "ñ")
800 ("&nbsp;" " ")
801 ("&ograve;" "ò")
802 ("&oacute;" "ó")
803 ("&ocirc;" "ô")
804 ("&otilde;" "õ")
805 ("&ouml;" "ö")
806 ("&oslash;" "ø")
807 ("&ugrave;" "ù")
808 ("&uacute;" "ú")
809 ("&ucirc;" "û")
810 ("&uuml;" "ü")
811 ("&yacute;" "ý")
812 ("&thorn;" "þ")
813 ("&yuml;" "ÿ")))
815 ;;;###autoload
816 (defun iso-iso2sgml (from to &optional buffer)
817 "Translate ISO 8859-1 characters in the region to SGML entities.
818 Use entities from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\".
819 Optional arg BUFFER is ignored (for use in `format-alist')."
820 (interactive "*r")
821 (iso-translate-conventions from to iso-iso2sgml-trans-tab))
823 ;;;###autoload
824 (defun iso-sgml2iso (from to &optional buffer)
825 "Translate SGML entities in the region to ISO 8859-1 characters.
826 Use entities from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\".
827 Optional arg BUFFER is ignored (for use in `format-alist')."
828 (interactive "*r")
829 (iso-translate-conventions from to iso-sgml2iso-trans-tab))
831 ;;;###autoload
832 (defun iso-cvt-read-only (&rest ignore)
833 "Warn that format is read-only."
834 (interactive)
835 (error "This format is read-only; specify another format for writing"))
837 ;;;###autoload
838 (defun iso-cvt-write-only (&rest ignore)
839 "Warn that format is write-only."
840 (interactive)
841 (error "This format is write-only"))
843 ;;;###autoload
844 (defun iso-cvt-define-menu ()
845 "Add submenus to the File menu, to convert to and from various formats."
846 (interactive)
848 (let ((load-as-menu-map (make-sparse-keymap "Load As..."))
849 (insert-as-menu-map (make-sparse-keymap "Insert As..."))
850 (write-as-menu-map (make-sparse-keymap "Write As..."))
851 (translate-to-menu-map (make-sparse-keymap "Translate to..."))
852 (translate-from-menu-map (make-sparse-keymap "Translate from..."))
853 (menu menu-bar-file-menu))
855 (define-key menu [load-as-separator] '("--"))
857 (define-key menu [load-as] '("Load As..." . iso-cvt-load-as))
858 (fset 'iso-cvt-load-as load-as-menu-map)
860 ;;(define-key menu [insert-as] '("Insert As..." . iso-cvt-insert-as))
861 (fset 'iso-cvt-insert-as insert-as-menu-map)
863 (define-key menu [write-as] '("Write As..." . iso-cvt-write-as))
864 (fset 'iso-cvt-write-as write-as-menu-map)
866 (define-key menu [translate-separator] '("--"))
868 (define-key menu [translate-to] '("Translate to..." . iso-cvt-translate-to))
869 (fset 'iso-cvt-translate-to translate-to-menu-map)
871 (define-key menu [translate-from] '("Translate from..." . iso-cvt-translate-from))
872 (fset 'iso-cvt-translate-from translate-from-menu-map)
874 (dolist (file-type (reverse format-alist))
875 (let ((name (car file-type))
876 (str-name (cadr file-type)))
877 (if (stringp str-name)
878 (progn
879 (define-key load-as-menu-map (vector name)
880 (cons str-name
881 `(lambda (file)
882 (interactive ,(format "FFind file (as %s): " name))
883 (format-find-file file ',name))))
884 (define-key insert-as-menu-map (vector name)
885 (cons str-name
886 `(lambda (file)
887 (interactive (format "FInsert file (as %s): " ,name))
888 (format-insert-file file ',name))))
889 (define-key write-as-menu-map (vector name)
890 (cons str-name
891 `(lambda (file)
892 (interactive (format "FWrite file (as %s): " ,name))
893 (format-write-file file ',name))))
894 (define-key translate-to-menu-map (vector name)
895 (cons str-name
896 `(lambda ()
897 (interactive)
898 (format-encode-buffer ',name))))
899 (define-key translate-from-menu-map (vector name)
900 (cons str-name
901 `(lambda ()
902 (interactive)
903 (format-decode-buffer ',name))))))))))
905 (provide 'iso-cvt)
907 ;; arch-tag: 64ae843f-ed0e-43e1-ba50-ffd581b90840
908 ;;; iso-cvt.el ends here