18228
|
1 ;;; iso-cvt.-el -- translate ISO 8859-1 from/to various encodings
|
13337
|
2 ;; This file was formerly called gm-lingo.el.
|
|
3
|
22911
|
4 ;; Copyright (C) 1993, 1994, 1995, 1996, 1998 Free Software Foundation, Inc.
|
7260
|
5
|
|
6 ;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at>
|
|
7 ;; Keywords: tex, iso, latin, i18n
|
|
8
|
|
9 ;; This file is part of GNU Emacs.
|
|
10
|
|
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
12 ;; it under the terms of the GNU General Public License as published by
|
|
13 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
14 ;; any later version.
|
|
15
|
|
16 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19 ;; GNU General Public License for more details.
|
|
20
|
|
21 ;; You should have received a copy of the GNU General Public License
|
14169
|
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
24 ;; Boston, MA 02111-1307, USA.
|
7260
|
25
|
22911
|
26 ;;; Commentary:
|
|
27 ;; This lisp code is a general framework for translating various
|
18228
|
28 ;; representations of the same data.
|
|
29 ;; among other things it can be used to translate TeX, HTML, and compressed
|
22911
|
30 ;; files to ISO 8859-1. It can also be used to translate different charsets
|
18228
|
31 ;; such as IBM PC, Macintosh or HP Roman8.
|
|
32 ;; Note that many translations use the GNU recode tool to do the actual
|
|
33 ;; conversion. So you might want to install that tool to get the full
|
|
34 ;; benefit of iso-cvt.el
|
|
35 ;
|
7425
|
36
|
18228
|
37 ; TO DO:
|
22911
|
38 ; Cover more cases for translation (There is an infinite number of ways to
|
18228
|
39 ; represent accented characters in TeX)
|
7260
|
40
|
18228
|
41 ;; SEE ALSO:
|
22911
|
42 ; If you are interested in questions related to using the ISO 8859-1
|
18228
|
43 ; characters set (configuring emacs, Unix, etc. to use ISO), then you
|
22911
|
44 ; can get the ISO 8859-1 FAQ via anonymous ftp from
|
18228
|
45 ; ftp.vlsivie.tuwien.ac.at in /pub/bit/FAQ-ISO-8859-1
|
7260
|
46
|
|
47 ;;; Code:
|
|
48
|
|
49 (provide 'iso-cvt)
|
18228
|
50 (require 'format)
|
7260
|
51
|
|
52 (defvar iso-spanish-trans-tab
|
|
53 '(
|
|
54 ("~n" "�")
|
|
55 ("\([a-zA-Z]\)#" "\\1�")
|
|
56 ("~N" "�")
|
|
57 ("\\([-a-zA-Z\"`]\\)\"u" "\\1�")
|
|
58 ("\\([-a-zA-Z\"`]\\)\"U" "\\1�")
|
|
59 ("\\([-a-zA-Z]\\)'o" "\\1�")
|
|
60 ("\\([-a-zA-Z]\\)'O" "\\�")
|
|
61 ("\\([-a-zA-Z]\\)'e" "\\1�")
|
|
62 ("\\([-a-zA-Z]\\)'E" "\\1�")
|
|
63 ("\\([-a-zA-Z]\\)'a" "\\1�")
|
|
64 ("\\([-a-zA-Z]\\)'A" "\\1A")
|
|
65 ("\\([-a-zA-Z]\\)'i" "\\1�")
|
|
66 ("\\([-a-zA-Z]\\)'I" "\\1�")
|
|
67 )
|
|
68 "Spanish translation table.")
|
|
69
|
18228
|
70 (defun iso-translate-conventions (from to trans-tab)
|
7850
|
71 "Use the translation table TRANS-TAB to translate the current buffer."
|
7260
|
72 (save-excursion
|
18228
|
73 (save-restriction
|
|
74 (narrow-to-region from to)
|
|
75 (goto-char from)
|
|
76 (let ((work-tab trans-tab)
|
|
77 (buffer-read-only nil)
|
|
78 (case-fold-search nil))
|
|
79 (while work-tab
|
|
80 (save-excursion
|
|
81 (let ((trans-this (car work-tab)))
|
|
82 (while (re-search-forward (car trans-this) nil t)
|
|
83 (replace-match (car (cdr trans-this)) t nil)))
|
|
84 (setq work-tab (cdr work-tab)))))
|
|
85 (point-max))))
|
7260
|
86
|
22911
|
87 ;;;###autoload
|
|
88 (defun iso-spanish (from to &optional buffer)
|
|
89 "Translate net conventions for Spanish to ISO 8859-1.
|
|
90 The region between FROM and TO is translated using the table TRANS-TAB.
|
|
91 Optional arg BUFFER is ignored (so that the function can can be used in
|
|
92 `format-alist')."
|
|
93 (interactive "*r")
|
18228
|
94 (iso-translate-conventions from to iso-spanish-trans-tab))
|
7260
|
95
|
|
96 (defvar iso-aggressive-german-trans-tab
|
|
97 '(
|
|
98 ("\"a" "�")
|
|
99 ("\"A" "�")
|
|
100 ("\"o" "�")
|
|
101 ("\"O" "�")
|
|
102 ("\"u" "�")
|
|
103 ("\"U" "�")
|
|
104 ("\"s" "�")
|
|
105 ("\\\\3" "�")
|
|
106 )
|
22911
|
107 "German translation table.
|
10434
|
108 This table uses an aggressive translation approach and may erroneously
|
|
109 translate too much.")
|
7260
|
110
|
|
111 (defvar iso-conservative-german-trans-tab
|
|
112 '(
|
|
113 ("\\([-a-zA-Z\"`]\\)\"a" "\\1�")
|
|
114 ("\\([-a-zA-Z\"`]\\)\"A" "\\1�")
|
|
115 ("\\([-a-zA-Z\"`]\\)\"o" "\\1�")
|
|
116 ("\\([-a-zA-Z\"`]\\)\"O" "\\1�")
|
|
117 ("\\([-a-zA-Z\"`]\\)\"u" "\\1�")
|
|
118 ("\\([-a-zA-Z\"`]\\)\"U" "\\1�")
|
|
119 ("\\([-a-zA-Z\"`]\\)\"s" "\\1�")
|
|
120 ("\\([-a-zA-Z\"`]\\)\\\\3" "\\1�")
|
|
121 )
|
|
122 "German translation table.
|
22911
|
123 This table uses a conservative translation approach and may translate too
|
7260
|
124 little.")
|
|
125
|
22911
|
126 (defvar iso-german-trans-tab iso-aggressive-german-trans-tab
|
7260
|
127 "Currently active translation table for German.")
|
|
128
|
22911
|
129 ;;;###autoload
|
|
130 (defun iso-german (from to &optional buffer)
|
|
131 "Translate net conventions for German to ISO 8859-1.
|
|
132 The region between FROM and TO is translated using the table TRANS-TAB.
|
|
133 Optional arg BUFFER is ignored (so that the function can can be used in
|
|
134 `format-alist')."
|
|
135 (interactive "*r")
|
18228
|
136 (iso-translate-conventions from to iso-german-trans-tab))
|
7260
|
137
|
|
138 (defvar iso-iso2tex-trans-tab
|
|
139 '(
|
|
140 ("�" "{\\\\\"a}")
|
|
141 ("�" "{\\\\`a}")
|
|
142 ("�" "{\\\\'a}")
|
|
143 ("�" "{\\\\~a}")
|
|
144 ("�" "{\\\\^a}")
|
|
145 ("�" "{\\\\\"e}")
|
|
146 ("�" "{\\\\`e}")
|
|
147 ("�" "{\\\\'e}")
|
|
148 ("�" "{\\\\^e}")
|
|
149 ("�" "{\\\\\"\\\\i}")
|
|
150 ("�" "{\\\\`\\\\i}")
|
|
151 ("�" "{\\\\'\\\\i}")
|
|
152 ("�" "{\\\\^\\\\i}")
|
|
153 ("�" "{\\\\\"o}")
|
|
154 ("�" "{\\\\`o}")
|
|
155 ("�" "{\\\\'o}")
|
|
156 ("�" "{\\\\~o}")
|
|
157 ("�" "{\\\\^o}")
|
|
158 ("�" "{\\\\\"u}")
|
|
159 ("�" "{\\\\`u}")
|
|
160 ("�" "{\\\\'u}")
|
|
161 ("�" "{\\\\^u}")
|
|
162 ("�" "{\\\\\"A}")
|
|
163 ("�" "{\\\\`A}")
|
|
164 ("�" "{\\\\'A}")
|
|
165 ("�" "{\\\\~A}")
|
|
166 ("�" "{\\\\^A}")
|
|
167 ("�" "{\\\\\"E}")
|
|
168 ("�" "{\\\\`E}")
|
|
169 ("�" "{\\\\'E}")
|
|
170 ("�" "{\\\\^E}")
|
|
171 ("�" "{\\\\\"I}")
|
|
172 ("�" "{\\\\`I}")
|
|
173 ("�" "{\\\\'I}")
|
|
174 ("�" "{\\\\^I}")
|
|
175 ("�" "{\\\\\"O}")
|
|
176 ("�" "{\\\\`O}")
|
|
177 ("�" "{\\\\'O}")
|
|
178 ("�" "{\\\\~O}")
|
|
179 ("�" "{\\\\^O}")
|
|
180 ("�" "{\\\\\"U}")
|
|
181 ("�" "{\\\\`U}")
|
|
182 ("�" "{\\\\'U}")
|
|
183 ("�" "{\\\\^U}")
|
|
184 ("�" "{\\\\~n}")
|
|
185 ("�" "{\\\\~N}")
|
|
186 ("�" "{\\\\c c}")
|
|
187 ("�" "{\\\\c C}")
|
|
188 ("�" "{\\\\ss}")
|
7861
|
189 ("\306" "{\\\\AE}")
|
|
190 ("\346" "{\\\\ae}")
|
10081
|
191 ("\305" "{\\\\AA}")
|
|
192 ("\345" "{\\\\aa}")
|
7861
|
193 ("\251" "{\\\\copyright}")
|
10081
|
194 ("�" "{\\\\pounds}")
|
|
195 ("�" "{\\\\P}")
|
|
196 ("�" "{\\\\S}")
|
7260
|
197 ("�" "{?`}")
|
|
198 ("�" "{!`}")
|
|
199 )
|
|
200 "Translation table for translating ISO 8859-1 characters to TeX sequences.")
|
|
201
|
22911
|
202 ;;;###autoload
|
|
203 (defun iso-iso2tex (from to &optional buffer)
|
|
204 "Translate ISO 8859-1 characters to TeX sequences.
|
|
205 The region between FROM and TO is translated using the table TRANS-TAB.
|
|
206 Optional arg BUFFER is ignored (so that the function can can be used in
|
|
207 `format-alist')."
|
|
208 (interactive "*r")
|
18228
|
209 (iso-translate-conventions from to iso-iso2tex-trans-tab))
|
7260
|
210
|
|
211 (defvar iso-tex2iso-trans-tab
|
|
212 '(
|
|
213 ("{\\\\\"a}" "�")
|
|
214 ("{\\\\`a}" "�")
|
|
215 ("{\\\\'a}" "�")
|
|
216 ("{\\\\~a}" "�")
|
|
217 ("{\\\\^a}" "�")
|
|
218 ("{\\\\\"e}" "�")
|
|
219 ("{\\\\`e}" "�")
|
|
220 ("{\\\\'e}" "�")
|
|
221 ("{\\\\^e}" "�")
|
|
222 ("{\\\\\"\\\\i}" "�")
|
|
223 ("{\\\\`\\\\i}" "�")
|
|
224 ("{\\\\'\\\\i}" "�")
|
|
225 ("{\\\\^\\\\i}" "�")
|
|
226 ("{\\\\\"i}" "�")
|
|
227 ("{\\\\`i}" "�")
|
|
228 ("{\\\\'i}" "�")
|
|
229 ("{\\\\^i}" "�")
|
|
230 ("{\\\\\"o}" "�")
|
|
231 ("{\\\\`o}" "�")
|
|
232 ("{\\\\'o}" "�")
|
|
233 ("{\\\\~o}" "�")
|
|
234 ("{\\\\^o}" "�")
|
|
235 ("{\\\\\"u}" "�")
|
|
236 ("{\\\\`u}" "�")
|
|
237 ("{\\\\'u}" "�")
|
|
238 ("{\\\\^u}" "�")
|
|
239 ("{\\\\\"A}" "�")
|
|
240 ("{\\\\`A}" "�")
|
|
241 ("{\\\\'A}" "�")
|
|
242 ("{\\\\~A}" "�")
|
|
243 ("{\\\\^A}" "�")
|
|
244 ("{\\\\\"E}" "�")
|
|
245 ("{\\\\`E}" "�")
|
|
246 ("{\\\\'E}" "�")
|
|
247 ("{\\\\^E}" "�")
|
|
248 ("{\\\\\"I}" "�")
|
|
249 ("{\\\\`I}" "�")
|
|
250 ("{\\\\'I}" "�")
|
|
251 ("{\\\\^I}" "�")
|
|
252 ("{\\\\\"O}" "�")
|
|
253 ("{\\\\`O}" "�")
|
|
254 ("{\\\\'O}" "�")
|
|
255 ("{\\\\~O}" "�")
|
|
256 ("{\\\\^O}" "�")
|
|
257 ("{\\\\\"U}" "�")
|
|
258 ("{\\\\`U}" "�")
|
|
259 ("{\\\\'U}" "�")
|
|
260 ("{\\\\^U}" "�")
|
|
261 ("{\\\\~n}" "�")
|
|
262 ("{\\\\~N}" "�")
|
|
263 ("{\\\\c c}" "�")
|
|
264 ("{\\\\c C}" "�")
|
7861
|
265 ("\\\\\"a" "�")
|
|
266 ("\\\\`a" "�")
|
|
267 ("\\\\'a" "�")
|
|
268 ("\\\\~a" "�")
|
|
269 ("\\\\^a" "�")
|
|
270 ("\\\\\"e" "�")
|
|
271 ("\\\\`e" "�")
|
|
272 ("\\\\'e" "�")
|
|
273 ("\\\\^e" "�")
|
|
274 ("\\\\\"\\\\i" "�")
|
|
275 ("\\\\`\\\\i" "�")
|
|
276 ("\\\\'\\\\i" "�")
|
|
277 ("\\\\^\\\\i" "�")
|
|
278 ("\\\\\"i" "�")
|
|
279 ("\\\\`i" "�")
|
|
280 ("\\\\'i" "�")
|
|
281 ("\\\\^i" "�")
|
|
282 ("\\\\\"o" "�")
|
|
283 ("\\\\`o" "�")
|
|
284 ("\\\\'o" "�")
|
|
285 ("\\\\~o" "�")
|
|
286 ("\\\\^o" "�")
|
|
287 ("\\\\\"u" "�")
|
|
288 ("\\\\`u" "�")
|
|
289 ("\\\\'u" "�")
|
|
290 ("\\\\^u" "�")
|
|
291 ("\\\\\"A" "�")
|
|
292 ("\\\\`A" "�")
|
|
293 ("\\\\'A" "�")
|
|
294 ("\\\\~A" "�")
|
|
295 ("\\\\^A" "�")
|
|
296 ("\\\\\"E" "�")
|
|
297 ("\\\\`E" "�")
|
|
298 ("\\\\'E" "�")
|
|
299 ("\\\\^E" "�")
|
|
300 ("\\\\\"I" "�")
|
|
301 ("\\\\`I" "�")
|
|
302 ("\\\\'I" "�")
|
|
303 ("\\\\^I" "�")
|
|
304 ("\\\\\"O" "�")
|
|
305 ("\\\\`O" "�")
|
|
306 ("\\\\'O" "�")
|
|
307 ("\\\\~O" "�")
|
|
308 ("\\\\^O" "�")
|
|
309 ("\\\\\"U" "�")
|
|
310 ("\\\\`U" "�")
|
|
311 ("\\\\'U" "�")
|
|
312 ("\\\\^U" "�")
|
|
313 ("\\\\~n" "�")
|
|
314 ("\\\\~N" "�")
|
7260
|
315 ("\\\\\"{a}" "�")
|
|
316 ("\\\\`{a}" "�")
|
|
317 ("\\\\'{a}" "�")
|
|
318 ("\\\\~{a}" "�")
|
|
319 ("\\\\^{a}" "�")
|
|
320 ("\\\\\"{e}" "�")
|
|
321 ("\\\\`{e}" "�")
|
|
322 ("\\\\'{e}" "�")
|
|
323 ("\\\\^{e}" "�")
|
|
324 ("\\\\\"{\\\\i}" "�")
|
|
325 ("\\\\`{\\\\i}" "�")
|
|
326 ("\\\\'{\\\\i}" "�")
|
|
327 ("\\\\^{\\\\i}" "�")
|
|
328 ("\\\\\"{i}" "�")
|
|
329 ("\\\\`{i}" "�")
|
|
330 ("\\\\'{i}" "�")
|
|
331 ("\\\\^{i}" "�")
|
|
332 ("\\\\\"{o}" "�")
|
|
333 ("\\\\`{o}" "�")
|
|
334 ("\\\\'{o}" "�")
|
|
335 ("\\\\~{o}" "�")
|
|
336 ("\\\\^{o}" "�")
|
|
337 ("\\\\\"{u}" "�")
|
|
338 ("\\\\`{u}" "�")
|
|
339 ("\\\\'{u}" "�")
|
|
340 ("\\\\^{u}" "�")
|
|
341 ("\\\\\"{A}" "�")
|
|
342 ("\\\\`{A}" "�")
|
|
343 ("\\\\'{A}" "�")
|
|
344 ("\\\\~{A}" "�")
|
|
345 ("\\\\^{A}" "�")
|
|
346 ("\\\\\"{E}" "�")
|
|
347 ("\\\\`{E}" "�")
|
|
348 ("\\\\'{E}" "�")
|
|
349 ("\\\\^{E}" "�")
|
|
350 ("\\\\\"{I}" "�")
|
|
351 ("\\\\`{I}" "�")
|
|
352 ("\\\\'{I}" "�")
|
|
353 ("\\\\^{I}" "�")
|
|
354 ("\\\\\"{O}" "�")
|
|
355 ("\\\\`{O}" "�")
|
|
356 ("\\\\'{O}" "�")
|
|
357 ("\\\\~{O}" "�")
|
|
358 ("\\\\^{O}" "�")
|
|
359 ("\\\\\"{U}" "�")
|
|
360 ("\\\\`{U}" "�")
|
|
361 ("\\\\'{U}" "�")
|
|
362 ("\\\\^{U}" "�")
|
|
363 ("\\\\~{n}" "�")
|
|
364 ("\\\\~{N}" "�")
|
|
365 ("\\\\c{c}" "�")
|
|
366 ("\\\\c{C}" "�")
|
|
367 ("{\\\\ss}" "�")
|
7861
|
368 ("{\\\\AE}" "\306")
|
|
369 ("{\\\\ae}" "\346")
|
10081
|
370 ("{\\\\AA}" "\305")
|
|
371 ("{\\\\aa}" "\345")
|
7861
|
372 ("{\\\\copyright}" "\251")
|
|
373 ("\\\\copyright{}" "\251")
|
10081
|
374 ("{\\\\pounds}" "�" )
|
|
375 ("{\\\\P}" "�" )
|
|
376 ("{\\\\S}" "�" )
|
|
377 ("\\\\pounds{}" "�" )
|
|
378 ("\\\\P{}" "�" )
|
|
379 ("\\\\S{}" "�" )
|
8538
|
380 ("{\\?`}" "�")
|
|
381 ("{!`}" "�")
|
|
382 ("\\?`" "�")
|
7260
|
383 ("!`" "�")
|
|
384 )
|
22911
|
385 "Translation table for translating TeX sequences to ISO 8859-1 characters.
|
|
386 This table is not exhaustive (and due to TeX's power can never be). It only
|
7260
|
387 contains commonly used sequences.")
|
|
388
|
22911
|
389 ;;;###autoload
|
|
390 (defun iso-tex2iso (from to &optional buffer)
|
|
391 "Translate TeX sequences to ISO 8859-1 characters.
|
|
392 The region between FROM and TO is translated using the table TRANS-TAB.
|
|
393 Optional arg BUFFER is ignored (so that the function can can be used in
|
|
394 `format-alist')."
|
|
395 (interactive "*r")
|
18228
|
396 (iso-translate-conventions from to iso-tex2iso-trans-tab))
|
7260
|
397
|
|
398 (defvar iso-gtex2iso-trans-tab
|
|
399 '(
|
|
400 ("{\\\\\"a}" "�")
|
|
401 ("{\\\\`a}" "�")
|
|
402 ("{\\\\'a}" "�")
|
|
403 ("{\\\\~a}" "�")
|
|
404 ("{\\\\^a}" "�")
|
|
405 ("{\\\\\"e}" "�")
|
|
406 ("{\\\\`e}" "�")
|
|
407 ("{\\\\'e}" "�")
|
|
408 ("{\\\\^e}" "�")
|
|
409 ("{\\\\\"\\\\i}" "�")
|
|
410 ("{\\\\`\\\\i}" "�")
|
|
411 ("{\\\\'\\\\i}" "�")
|
|
412 ("{\\\\^\\\\i}" "�")
|
|
413 ("{\\\\\"i}" "�")
|
|
414 ("{\\\\`i}" "�")
|
|
415 ("{\\\\'i}" "�")
|
|
416 ("{\\\\^i}" "�")
|
|
417 ("{\\\\\"o}" "�")
|
|
418 ("{\\\\`o}" "�")
|
|
419 ("{\\\\'o}" "�")
|
|
420 ("{\\\\~o}" "�")
|
|
421 ("{\\\\^o}" "�")
|
|
422 ("{\\\\\"u}" "�")
|
|
423 ("{\\\\`u}" "�")
|
|
424 ("{\\\\'u}" "�")
|
|
425 ("{\\\\^u}" "�")
|
|
426 ("{\\\\\"A}" "�")
|
|
427 ("{\\\\`A}" "�")
|
|
428 ("{\\\\'A}" "�")
|
|
429 ("{\\\\~A}" "�")
|
|
430 ("{\\\\^A}" "�")
|
|
431 ("{\\\\\"E}" "�")
|
|
432 ("{\\\\`E}" "�")
|
|
433 ("{\\\\'E}" "�")
|
|
434 ("{\\\\^E}" "�")
|
|
435 ("{\\\\\"I}" "�")
|
|
436 ("{\\\\`I}" "�")
|
|
437 ("{\\\\'I}" "�")
|
|
438 ("{\\\\^I}" "�")
|
|
439 ("{\\\\\"O}" "�")
|
|
440 ("{\\\\`O}" "�")
|
|
441 ("{\\\\'O}" "�")
|
|
442 ("{\\\\~O}" "�")
|
|
443 ("{\\\\^O}" "�")
|
|
444 ("{\\\\\"U}" "�")
|
|
445 ("{\\\\`U}" "�")
|
|
446 ("{\\\\'U}" "�")
|
|
447 ("{\\\\^U}" "�")
|
|
448 ("{\\\\~n}" "�")
|
|
449 ("{\\\\~N}" "�")
|
|
450 ("{\\\\c c}" "�")
|
|
451 ("{\\\\c C}" "�")
|
7861
|
452 ("\\\\\"a" "�")
|
|
453 ("\\\\`a" "�")
|
|
454 ("\\\\'a" "�")
|
|
455 ("\\\\~a" "�")
|
|
456 ("\\\\^a" "�")
|
|
457 ("\\\\\"e" "�")
|
|
458 ("\\\\`e" "�")
|
|
459 ("\\\\'e" "�")
|
|
460 ("\\\\^e" "�")
|
|
461 ("\\\\\"\\\\i" "�")
|
|
462 ("\\\\`\\\\i" "�")
|
|
463 ("\\\\'\\\\i" "�")
|
|
464 ("\\\\^\\\\i" "�")
|
|
465 ("\\\\\"i" "�")
|
|
466 ("\\\\`i" "�")
|
|
467 ("\\\\'i" "�")
|
|
468 ("\\\\^i" "�")
|
|
469 ("\\\\\"o" "�")
|
|
470 ("\\\\`o" "�")
|
|
471 ("\\\\'o" "�")
|
|
472 ("\\\\~o" "�")
|
|
473 ("\\\\^o" "�")
|
|
474 ("\\\\\"u" "�")
|
|
475 ("\\\\`u" "�")
|
|
476 ("\\\\'u" "�")
|
|
477 ("\\\\^u" "�")
|
|
478 ("\\\\\"A" "�")
|
|
479 ("\\\\`A" "�")
|
|
480 ("\\\\'A" "�")
|
|
481 ("\\\\~A" "�")
|
|
482 ("\\\\^A" "�")
|
|
483 ("\\\\\"E" "�")
|
|
484 ("\\\\`E" "�")
|
|
485 ("\\\\'E" "�")
|
|
486 ("\\\\^E" "�")
|
|
487 ("\\\\\"I" "�")
|
|
488 ("\\\\`I" "�")
|
|
489 ("\\\\'I" "�")
|
|
490 ("\\\\^I" "�")
|
|
491 ("\\\\\"O" "�")
|
|
492 ("\\\\`O" "�")
|
|
493 ("\\\\'O" "�")
|
|
494 ("\\\\~O" "�")
|
|
495 ("\\\\^O" "�")
|
|
496 ("\\\\\"U" "�")
|
|
497 ("\\\\`U" "�")
|
|
498 ("\\\\'U" "�")
|
|
499 ("\\\\^U" "�")
|
|
500 ("\\\\~n" "�")
|
|
501 ("\\\\~N" "�")
|
7260
|
502 ("\\\\\"{a}" "�")
|
|
503 ("\\\\`{a}" "�")
|
|
504 ("\\\\'{a}" "�")
|
|
505 ("\\\\~{a}" "�")
|
|
506 ("\\\\^{a}" "�")
|
|
507 ("\\\\\"{e}" "�")
|
|
508 ("\\\\`{e}" "�")
|
|
509 ("\\\\'{e}" "�")
|
|
510 ("\\\\^{e}" "�")
|
|
511 ("\\\\\"{\\\\i}" "�")
|
|
512 ("\\\\`{\\\\i}" "�")
|
|
513 ("\\\\'{\\\\i}" "�")
|
|
514 ("\\\\^{\\\\i}" "�")
|
|
515 ("\\\\\"{i}" "�")
|
|
516 ("\\\\`{i}" "�")
|
|
517 ("\\\\'{i}" "�")
|
|
518 ("\\\\^{i}" "�")
|
|
519 ("\\\\\"{o}" "�")
|
|
520 ("\\\\`{o}" "�")
|
|
521 ("\\\\'{o}" "�")
|
|
522 ("\\\\~{o}" "�")
|
|
523 ("\\\\^{o}" "�")
|
|
524 ("\\\\\"{u}" "�")
|
|
525 ("\\\\`{u}" "�")
|
|
526 ("\\\\'{u}" "�")
|
|
527 ("\\\\^{u}" "�")
|
|
528 ("\\\\\"{A}" "�")
|
|
529 ("\\\\`{A}" "�")
|
|
530 ("\\\\'{A}" "�")
|
|
531 ("\\\\~{A}" "�")
|
|
532 ("\\\\^{A}" "�")
|
|
533 ("\\\\\"{E}" "�")
|
|
534 ("\\\\`{E}" "�")
|
|
535 ("\\\\'{E}" "�")
|
|
536 ("\\\\^{E}" "�")
|
|
537 ("\\\\\"{I}" "�")
|
|
538 ("\\\\`{I}" "�")
|
|
539 ("\\\\'{I}" "�")
|
|
540 ("\\\\^{I}" "�")
|
|
541 ("\\\\\"{O}" "�")
|
|
542 ("\\\\`{O}" "�")
|
|
543 ("\\\\'{O}" "�")
|
|
544 ("\\\\~{O}" "�")
|
|
545 ("\\\\^{O}" "�")
|
|
546 ("\\\\\"{U}" "�")
|
|
547 ("\\\\`{U}" "�")
|
|
548 ("\\\\'{U}" "�")
|
|
549 ("\\\\^{U}" "�")
|
|
550 ("\\\\~{n}" "�")
|
|
551 ("\\\\~{N}" "�")
|
|
552 ("\\\\c{c}" "�")
|
|
553 ("\\\\c{C}" "�")
|
|
554 ("{\\\\ss}" "�")
|
7861
|
555 ("{\\\\AE}" "\306")
|
|
556 ("{\\\\ae}" "\346")
|
10081
|
557 ("{\\\\AA}" "\305")
|
|
558 ("{\\\\aa}" "\345")
|
7861
|
559 ("{\\\\copyright}" "\251")
|
|
560 ("\\\\copyright{}" "\251")
|
10081
|
561 ("{\\\\pounds}" "�" )
|
|
562 ("{\\\\P}" "�" )
|
|
563 ("{\\\\S}" "�" )
|
|
564 ("\\\\pounds{}" "�" )
|
|
565 ("\\\\P{}" "�" )
|
|
566 ("\\\\S{}" "�" )
|
7260
|
567 ("?`" "�")
|
|
568 ("!`" "�")
|
|
569 ("{?`}" "�")
|
|
570 ("{!`}" "�")
|
7425
|
571 ("\"a" "�")
|
|
572 ("\"A" "�")
|
|
573 ("\"o" "�")
|
|
574 ("\"O" "�")
|
|
575 ("\"u" "�")
|
|
576 ("\"U" "�")
|
|
577 ("\"s" "�")
|
|
578 ("\\\\3" "�")
|
7260
|
579 )
|
|
580 "Translation table for translating German TeX sequences to ISO 8859-1.
|
|
581 This table is not exhaustive (and due to TeX's power can never be). It only
|
|
582 contains commonly used sequences.")
|
|
583
|
|
584 (defvar iso-iso2gtex-trans-tab
|
|
585 '(
|
|
586 ("�" "\"a")
|
|
587 ("�" "{\\\\`a}")
|
|
588 ("�" "{\\\\'a}")
|
|
589 ("�" "{\\\\~a}")
|
|
590 ("�" "{\\\\^a}")
|
|
591 ("�" "{\\\\\"e}")
|
|
592 ("�" "{\\\\`e}")
|
|
593 ("�" "{\\\\'e}")
|
|
594 ("�" "{\\\\^e}")
|
|
595 ("�" "{\\\\\"\\\\i}")
|
|
596 ("�" "{\\\\`\\\\i}")
|
|
597 ("�" "{\\\\'\\\\i}")
|
|
598 ("�" "{\\\\^\\\\i}")
|
|
599 ("�" "\"o")
|
|
600 ("�" "{\\\\`o}")
|
|
601 ("�" "{\\\\'o}")
|
|
602 ("�" "{\\\\~o}")
|
|
603 ("�" "{\\\\^o}")
|
|
604 ("�" "\"u")
|
|
605 ("�" "{\\\\`u}")
|
|
606 ("�" "{\\\\'u}")
|
|
607 ("�" "{\\\\^u}")
|
|
608 ("�" "\"A")
|
|
609 ("�" "{\\\\`A}")
|
|
610 ("�" "{\\\\'A}")
|
|
611 ("�" "{\\\\~A}")
|
|
612 ("�" "{\\\\^A}")
|
|
613 ("�" "{\\\\\"E}")
|
|
614 ("�" "{\\\\`E}")
|
|
615 ("�" "{\\\\'E}")
|
|
616 ("�" "{\\\\^E}")
|
|
617 ("�" "{\\\\\"I}")
|
|
618 ("�" "{\\\\`I}")
|
|
619 ("�" "{\\\\'I}")
|
|
620 ("�" "{\\\\^I}")
|
|
621 ("�" "\"O")
|
|
622 ("�" "{\\\\`O}")
|
|
623 ("�" "{\\\\'O}")
|
|
624 ("�" "{\\\\~O}")
|
|
625 ("�" "{\\\\^O}")
|
|
626 ("�" "\"U")
|
|
627 ("�" "{\\\\`U}")
|
|
628 ("�" "{\\\\'U}")
|
|
629 ("�" "{\\\\^U}")
|
|
630 ("�" "{\\\\~n}")
|
|
631 ("�" "{\\\\~N}")
|
|
632 ("�" "{\\\\c c}")
|
|
633 ("�" "{\\\\c C}")
|
|
634 ("�" "\"s")
|
7861
|
635 ("\306" "{\\\\AE}")
|
|
636 ("\346" "{\\\\ae}")
|
10081
|
637 ("\305" "{\\\\AA}")
|
|
638 ("\345" "{\\\\aa}")
|
7861
|
639 ("\251" "{\\\\copyright}")
|
10081
|
640 ("�" "{\\\\pounds}")
|
|
641 ("�" "{\\\\P}")
|
|
642 ("�" "{\\\\S}")
|
7260
|
643 ("�" "{?`}")
|
|
644 ("�" "{!`}")
|
|
645 )
|
|
646 "Translation table for translating ISO 8859-1 characters to German TeX.")
|
|
647
|
22911
|
648 ;;;###autoload
|
|
649 (defun iso-gtex2iso (from to &optional buffer)
|
|
650 "Translate German TeX sequences to ISO 8859-1 characters.
|
|
651 The region between FROM and TO is translated using the table TRANS-TAB.
|
|
652 Optional arg BUFFER is ignored (so that the function can can be used in
|
|
653 `format-alist')."
|
|
654 (interactive "*r")
|
18228
|
655 (iso-translate-conventions from to iso-gtex2iso-trans-tab))
|
7260
|
656
|
22911
|
657 ;;;###autoload
|
|
658 (defun iso-iso2gtex (from to &optional buffer)
|
|
659 "Translate ISO 8859-1 characters to German TeX sequences.
|
|
660 The region between FROM and TO is translated using the table TRANS-TAB.
|
|
661 Optional arg BUFFER is ignored (so that the function can can be used in
|
|
662 `format-alist')."
|
|
663 (interactive "*r")
|
18228
|
664 (iso-translate-conventions from to iso-iso2gtex-trans-tab))
|
|
665
|
|
666 (defvar iso-iso2duden-trans-tab
|
|
667 '(("�" "ae")
|
|
668 ("�" "Ae")
|
|
669 ("�" "oe")
|
|
670 ("�" "Oe")
|
|
671 ("�" "ue")
|
|
672 ("�" "Ue")
|
|
673 ("�" "ss")))
|
|
674
|
22911
|
675 ;;;###autoload
|
|
676 (defun iso-iso2duden (from to &optional buffer)
|
|
677 "Translate ISO 8859-1 characters to German TeX sequences.
|
|
678 The region between FROM and TO is translated using the table TRANS-TAB.
|
|
679 Optional arg BUFFER is ignored (so that the function can can be used in
|
|
680 `format-alist')."
|
|
681 (interactive "*r")
|
18228
|
682 (iso-translate-conventions from to iso-iso2duden-trans-tab))
|
7260
|
683
|
22911
|
684 ;;;###autoload
|
18228
|
685 (defun iso-cvt-read-only ()
|
22911
|
686 "Warn that format is read-only."
|
18228
|
687 (interactive)
|
|
688 (error "This format is read-only; specify another format for writing"))
|
|
689
|
22911
|
690 ;;;###autoload
|
18228
|
691 (defun iso-cvt-write-only ()
|
22911
|
692 "Warn that format is write-only."
|
18228
|
693 (interactive)
|
|
694 (error "This format is write-only"))
|
|
695
|
22911
|
696 ;;;###autoload
|
18228
|
697 (defun iso-cvt-define-menu ()
|
|
698 "Add submenus to the Files menu, to convert to and from various formats."
|
|
699 (interactive)
|
|
700
|
|
701 (define-key menu-bar-files-menu [load-as-separator] '("--"))
|
|
702
|
|
703 (define-key menu-bar-files-menu [load-as] '("Load As..." . load-as))
|
|
704 (defvar load-as-menu-map (make-sparse-keymap "Load As..."))
|
|
705 (fset 'load-as load-as-menu-map)
|
|
706
|
|
707 ;;(define-key menu-bar-files-menu [insert-as] '("Insert As..." . insert-as))
|
|
708 (defvar insert-as-menu-map (make-sparse-keymap "Insert As..."))
|
|
709 (fset 'insert-as insert-as-menu-map)
|
7260
|
710
|
18228
|
711 (define-key menu-bar-files-menu [write-as] '("Write As..." . write-as))
|
|
712 (defvar write-as-menu-map (make-sparse-keymap "Write As..."))
|
|
713 (fset 'write-as write-as-menu-map)
|
|
714
|
|
715 (define-key menu-bar-files-menu [translate-separator] '("--"))
|
|
716
|
|
717 (define-key menu-bar-files-menu [translate-to] '("Translate to..." . translate-to))
|
|
718 (defvar translate-to-menu-map (make-sparse-keymap "Translate to..."))
|
|
719 (fset 'translate-to translate-to-menu-map)
|
|
720
|
|
721 (define-key menu-bar-files-menu [translate-from] '("Translate from..." . translate-from))
|
|
722 (defvar translate-from-menu-map (make-sparse-keymap "Translate from..."))
|
|
723 (fset 'translate-from translate-from-menu-map)
|
7260
|
724
|
18228
|
725 (let ((file-types (reverse format-alist))
|
|
726 name
|
|
727 str-name)
|
22911
|
728 (while file-types
|
18228
|
729 (setq name (car (car file-types))
|
|
730 str-name (car (cdr (car file-types)))
|
|
731 file-types (cdr file-types))
|
|
732 (if (stringp str-name)
|
|
733 (progn
|
|
734 (define-key load-as-menu-map (vector name)
|
22911
|
735 (cons str-name
|
18228
|
736 (list 'lambda '(file) (list 'interactive (format "FFind file (as %s): " name))
|
|
737 (list 'format-find-file 'file (list 'quote name)))))
|
|
738 (define-key insert-as-menu-map (vector name)
|
22911
|
739 (cons str-name
|
18228
|
740 (list 'lambda '(file) (list 'interactive (format "FInsert file (as %s): " name))
|
|
741 (list 'format-insert-file 'file (list 'quote name)))))
|
|
742 (define-key write-as-menu-map (vector name)
|
22911
|
743 (cons str-name
|
18228
|
744 (list 'lambda '(file) (list 'interactive (format "FWrite file (as %s): " name))
|
|
745 (list 'format-write-file 'file (list 'quote (list name))))))
|
|
746 (define-key translate-to-menu-map (vector name)
|
22911
|
747 (cons str-name
|
18228
|
748 (list 'lambda '() '(interactive)
|
|
749 (list 'format-encode-buffer (list 'quote name)))))
|
|
750 (define-key translate-from-menu-map (vector name)
|
22911
|
751 (cons str-name
|
18228
|
752 (list 'lambda '() '(interactive)
|
|
753 (list 'format-decode-buffer (list 'quote (list name))))))
|
|
754 )))))
|
7260
|
755
|
|
756 ;;; iso-cvt.el ends here
|