38436
|
1 ;;; iso-cvt.el --- translate ISO 8859-1 from/to various encodings -*- coding: iso-latin-1 -*-
|
13337
|
2 ;; This file was formerly called gm-lingo.el.
|
|
3
|
74544
|
4 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
|
100908
|
5 ;; 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
7260
|
6
|
|
7 ;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at>
|
|
8 ;; Keywords: tex, iso, latin, i18n
|
|
9
|
|
10 ;; This file is part of GNU Emacs.
|
|
11
|
94664
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
|
7260
|
13 ;; it under the terms of the GNU General Public License as published by
|
94664
|
14 ;; the Free Software Foundation, either version 3 of the License, or
|
|
15 ;; (at your option) any later version.
|
7260
|
16
|
|
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.
|
|
21
|
|
22 ;; You should have received a copy of the GNU General Public License
|
94664
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
7260
|
24
|
22911
|
25 ;;; Commentary:
|
|
26 ;; This lisp code is a general framework for translating various
|
18228
|
27 ;; representations of the same data.
|
|
28 ;; among other things it can be used to translate TeX, HTML, and compressed
|
22911
|
29 ;; files to ISO 8859-1. It can also be used to translate different charsets
|
18228
|
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
|
7425
|
34
|
18228
|
35 ; TO DO:
|
28393
|
36 ; Cover more cases for translation. (There is an infinite number of ways to
|
18228
|
37 ; represent accented characters in TeX)
|
7260
|
38
|
18228
|
39 ;; SEE ALSO:
|
22911
|
40 ; If you are interested in questions related to using the ISO 8859-1
|
18228
|
41 ; characters set (configuring emacs, Unix, etc. to use ISO), then you
|
22911
|
42 ; can get the ISO 8859-1 FAQ via anonymous ftp from
|
28425
|
43 ; ftp.vlsivie.tuwien.ac.at in /pub/8bit/FAQ-ISO-8859-1
|
7260
|
44
|
|
45 ;;; Code:
|
|
46
|
|
47 (defvar iso-spanish-trans-tab
|
|
48 '(
|
|
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�")
|
|
62 )
|
|
63 "Spanish translation table.")
|
|
64
|
18228
|
65 (defun iso-translate-conventions (from to trans-tab)
|
79378
|
66 "Translate between FROM and TO using the translation table TRANS-TAB."
|
7260
|
67 (save-excursion
|
18228
|
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))))
|
7260
|
81
|
22911
|
82 ;;;###autoload
|
|
83 (defun iso-spanish (from to &optional buffer)
|
|
84 "Translate net conventions for Spanish to ISO 8859-1.
|
79378
|
85 Translate the region between FROM and TO using the table
|
|
86 `iso-spanish-trans-tab'.
|
34753
|
87 Optional arg BUFFER is ignored (for use in `format-alist')."
|
22911
|
88 (interactive "*r")
|
18228
|
89 (iso-translate-conventions from to iso-spanish-trans-tab))
|
7260
|
90
|
|
91 (defvar iso-aggressive-german-trans-tab
|
|
92 '(
|
|
93 ("\"a" "�")
|
|
94 ("\"A" "�")
|
|
95 ("\"o" "�")
|
|
96 ("\"O" "�")
|
|
97 ("\"u" "�")
|
|
98 ("\"U" "�")
|
|
99 ("\"s" "�")
|
|
100 ("\\\\3" "�")
|
|
101 )
|
22911
|
102 "German translation table.
|
79378
|
103 This table uses an aggressive translation approach
|
|
104 and may erroneously translate too much.")
|
7260
|
105
|
|
106 (defvar iso-conservative-german-trans-tab
|
|
107 '(
|
|
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�")
|
|
116 )
|
|
117 "German translation table.
|
79378
|
118 This table uses a conservative translation approach
|
|
119 and may translate too little.")
|
7260
|
120
|
22911
|
121 (defvar iso-german-trans-tab iso-aggressive-german-trans-tab
|
7260
|
122 "Currently active translation table for German.")
|
|
123
|
22911
|
124 ;;;###autoload
|
|
125 (defun iso-german (from to &optional buffer)
|
|
126 "Translate net conventions for German to ISO 8859-1.
|
79378
|
127 Translate the region FROM and TO using the table
|
|
128 `iso-german-trans-tab'.
|
34753
|
129 Optional arg BUFFER is ignored (for use in `format-alist')."
|
22911
|
130 (interactive "*r")
|
18228
|
131 (iso-translate-conventions from to iso-german-trans-tab))
|
49598
|
132
|
7260
|
133 (defvar iso-iso2tex-trans-tab
|
|
134 '(
|
|
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}")
|
7861
|
184 ("\306" "{\\\\AE}")
|
|
185 ("\346" "{\\\\ae}")
|
10081
|
186 ("\305" "{\\\\AA}")
|
|
187 ("\345" "{\\\\aa}")
|
7861
|
188 ("\251" "{\\\\copyright}")
|
10081
|
189 ("�" "{\\\\pounds}")
|
|
190 ("�" "{\\\\P}")
|
|
191 ("�" "{\\\\S}")
|
7260
|
192 ("�" "{?`}")
|
|
193 ("�" "{!`}")
|
|
194 )
|
|
195 "Translation table for translating ISO 8859-1 characters to TeX sequences.")
|
|
196
|
22911
|
197 ;;;###autoload
|
|
198 (defun iso-iso2tex (from to &optional buffer)
|
|
199 "Translate ISO 8859-1 characters to TeX sequences.
|
79378
|
200 Translate the region between FROM and TO using the table
|
|
201 `iso-iso2tex-trans-tab'.
|
34753
|
202 Optional arg BUFFER is ignored (for use in `format-alist')."
|
22911
|
203 (interactive "*r")
|
18228
|
204 (iso-translate-conventions from to iso-iso2tex-trans-tab))
|
7260
|
205
|
|
206 (defvar iso-tex2iso-trans-tab
|
|
207 '(
|
|
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}" "�")
|
7861
|
260 ("\\\\\"a" "�")
|
|
261 ("\\\\`a" "�")
|
|
262 ("\\\\'a" "�")
|
|
263 ("\\\\~a" "�")
|
|
264 ("\\\\^a" "�")
|
|
265 ("\\\\\"e" "�")
|
|
266 ("\\\\`e" "�")
|
|
267 ("\\\\'e" "�")
|
|
268 ("\\\\^e" "�")
|
58278
31a2a9c6a64d
(iso-tex2iso-trans-tab): Discard spaces after \i according to TeX rules.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
269 ;; Discard spaces and/or one EOF after macro \i.
|
31a2a9c6a64d
(iso-tex2iso-trans-tab): Discard spaces after \i according to TeX rules.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
270 ;; Converting it back will use braces.
|
31a2a9c6a64d
(iso-tex2iso-trans-tab): Discard spaces after \i according to TeX rules.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
271 ("\\\\\"\\\\i *\n\n" "�\n\n")
|
31a2a9c6a64d
(iso-tex2iso-trans-tab): Discard spaces after \i according to TeX rules.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
272 ("\\\\\"\\\\i *\n?" "�")
|
31a2a9c6a64d
(iso-tex2iso-trans-tab): Discard spaces after \i according to TeX rules.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
273 ("\\\\`\\\\i *\n\n" "�\n\n")
|
31a2a9c6a64d
(iso-tex2iso-trans-tab): Discard spaces after \i according to TeX rules.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
274 ("\\\\`\\\\i *\n?" "�")
|
31a2a9c6a64d
(iso-tex2iso-trans-tab): Discard spaces after \i according to TeX rules.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
275 ("\\\\'\\\\i *\n\n" "�\n\n")
|
31a2a9c6a64d
(iso-tex2iso-trans-tab): Discard spaces after \i according to TeX rules.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
276 ("\\\\'\\\\i *\n?" "�")
|
31a2a9c6a64d
(iso-tex2iso-trans-tab): Discard spaces after \i according to TeX rules.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
277 ("\\\\^\\\\i *\n\n" "�\n\n")
|
31a2a9c6a64d
(iso-tex2iso-trans-tab): Discard spaces after \i according to TeX rules.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
278 ("\\\\^\\\\i *\n?" "�")
|
7861
|
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" "�")
|
7260
|
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}" "�")
|
7861
|
369 ("{\\\\AE}" "\306")
|
|
370 ("{\\\\ae}" "\346")
|
10081
|
371 ("{\\\\AA}" "\305")
|
|
372 ("{\\\\aa}" "\345")
|
7861
|
373 ("{\\\\copyright}" "\251")
|
|
374 ("\\\\copyright{}" "\251")
|
10081
|
375 ("{\\\\pounds}" "�" )
|
|
376 ("{\\\\P}" "�" )
|
|
377 ("{\\\\S}" "�" )
|
|
378 ("\\\\pounds{}" "�" )
|
|
379 ("\\\\P{}" "�" )
|
|
380 ("\\\\S{}" "�" )
|
8538
|
381 ("{\\?`}" "�")
|
|
382 ("{!`}" "�")
|
|
383 ("\\?`" "�")
|
7260
|
384 ("!`" "�")
|
|
385 )
|
22911
|
386 "Translation table for translating TeX sequences to ISO 8859-1 characters.
|
79378
|
387 This table is not exhaustive (and due to TeX's power can never be).
|
|
388 It only contains commonly used sequences.")
|
7260
|
389
|
22911
|
390 ;;;###autoload
|
|
391 (defun iso-tex2iso (from to &optional buffer)
|
|
392 "Translate TeX sequences to ISO 8859-1 characters.
|
79378
|
393 Translate the region between FROM and TO using the table
|
|
394 `iso-tex2iso-trans-tab'.
|
34753
|
395 Optional arg BUFFER is ignored (for use in `format-alist')."
|
22911
|
396 (interactive "*r")
|
18228
|
397 (iso-translate-conventions from to iso-tex2iso-trans-tab))
|
7260
|
398
|
|
399 (defvar iso-gtex2iso-trans-tab
|
|
400 '(
|
|
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}" "�")
|
7861
|
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" "�")
|
7260
|
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}" "�")
|
7861
|
556 ("{\\\\AE}" "\306")
|
|
557 ("{\\\\ae}" "\346")
|
10081
|
558 ("{\\\\AA}" "\305")
|
|
559 ("{\\\\aa}" "\345")
|
7861
|
560 ("{\\\\copyright}" "\251")
|
|
561 ("\\\\copyright{}" "\251")
|
10081
|
562 ("{\\\\pounds}" "�" )
|
|
563 ("{\\\\P}" "�" )
|
|
564 ("{\\\\S}" "�" )
|
|
565 ("\\\\pounds{}" "�" )
|
|
566 ("\\\\P{}" "�" )
|
|
567 ("\\\\S{}" "�" )
|
7260
|
568 ("?`" "�")
|
|
569 ("!`" "�")
|
|
570 ("{?`}" "�")
|
|
571 ("{!`}" "�")
|
7425
|
572 ("\"a" "�")
|
|
573 ("\"A" "�")
|
|
574 ("\"o" "�")
|
|
575 ("\"O" "�")
|
|
576 ("\"u" "�")
|
|
577 ("\"U" "�")
|
|
578 ("\"s" "�")
|
|
579 ("\\\\3" "�")
|
7260
|
580 )
|
|
581 "Translation table for translating German TeX sequences to ISO 8859-1.
|
79378
|
582 This table is not exhaustive (and due to TeX's power can never be).
|
|
583 It only contains commonly used sequences.")
|
7260
|
584
|
|
585 (defvar iso-iso2gtex-trans-tab
|
|
586 '(
|
|
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")
|
7861
|
636 ("\306" "{\\\\AE}")
|
|
637 ("\346" "{\\\\ae}")
|
10081
|
638 ("\305" "{\\\\AA}")
|
|
639 ("\345" "{\\\\aa}")
|
7861
|
640 ("\251" "{\\\\copyright}")
|
10081
|
641 ("�" "{\\\\pounds}")
|
|
642 ("�" "{\\\\P}")
|
|
643 ("�" "{\\\\S}")
|
7260
|
644 ("�" "{?`}")
|
|
645 ("�" "{!`}")
|
|
646 )
|
|
647 "Translation table for translating ISO 8859-1 characters to German TeX.")
|
|
648
|
22911
|
649 ;;;###autoload
|
|
650 (defun iso-gtex2iso (from to &optional buffer)
|
|
651 "Translate German TeX sequences to ISO 8859-1 characters.
|
79378
|
652 Translate the region between FROM and TO using the table
|
|
653 `iso-gtex2iso-trans-tab'.
|
34753
|
654 Optional arg BUFFER is ignored (for use in `format-alist')."
|
22911
|
655 (interactive "*r")
|
18228
|
656 (iso-translate-conventions from to iso-gtex2iso-trans-tab))
|
7260
|
657
|
22911
|
658 ;;;###autoload
|
|
659 (defun iso-iso2gtex (from to &optional buffer)
|
|
660 "Translate ISO 8859-1 characters to German TeX sequences.
|
79378
|
661 Translate the region between FROM and TO using the table
|
|
662 `iso-iso2gtex-trans-tab'.
|
34753
|
663 Optional arg BUFFER is ignored (for use in `format-alist')."
|
22911
|
664 (interactive "*r")
|
18228
|
665 (iso-translate-conventions from to iso-iso2gtex-trans-tab))
|
|
666
|
|
667 (defvar iso-iso2duden-trans-tab
|
|
668 '(("�" "ae")
|
|
669 ("�" "Ae")
|
|
670 ("�" "oe")
|
|
671 ("�" "Oe")
|
|
672 ("�" "ue")
|
|
673 ("�" "Ue")
|
79357
|
674 ("�" "ss"))
|
|
675 "Translation table for translating ISO 8859-1 characters to Duden sequences.")
|
18228
|
676
|
22911
|
677 ;;;###autoload
|
|
678 (defun iso-iso2duden (from to &optional buffer)
|
79357
|
679 "Translate ISO 8859-1 characters to Duden sequences.
|
79378
|
680 Translate the region between FROM and TO using the table
|
|
681 `iso-iso2duden-trans-tab'.
|
34753
|
682 Optional arg BUFFER is ignored (for use in `format-alist')."
|
22911
|
683 (interactive "*r")
|
18228
|
684 (iso-translate-conventions from to iso-iso2duden-trans-tab))
|
7260
|
685
|
28393
|
686 (defvar iso-iso2sgml-trans-tab
|
|
687 '(("�" "À")
|
|
688 ("�" "Á")
|
|
689 ("�" "Â")
|
|
690 ("�" "Ã")
|
|
691 ("�" "Ä")
|
|
692 ("�" "Å")
|
|
693 ("�" "Æ")
|
|
694 ("�" "Ç")
|
|
695 ("�" "È")
|
|
696 ("�" "É")
|
|
697 ("�" "Ê")
|
|
698 ("�" "Ë")
|
|
699 ("�" "Ì")
|
|
700 ("�" "Í")
|
|
701 ("�" "Î")
|
|
702 ("�" "Ï")
|
|
703 ("�" "Ð")
|
|
704 ("�" "Ñ")
|
|
705 ("�" "Ò")
|
|
706 ("�" "Ó")
|
|
707 ("�" "Ô")
|
|
708 ("�" "Õ")
|
|
709 ("�" "Ö")
|
|
710 ("�" "Ø")
|
|
711 ("�" "Ù")
|
|
712 ("�" "Ú")
|
|
713 ("�" "Û")
|
|
714 ("�" "Ü")
|
|
715 ("�" "Ý")
|
|
716 ("�" "Þ")
|
|
717 ("�" "ß")
|
|
718 ("�" "à")
|
|
719 ("�" "á")
|
|
720 ("�" "â")
|
|
721 ("�" "ã")
|
|
722 ("�" "ä")
|
|
723 ("�" "å")
|
|
724 ("�" "æ")
|
|
725 ("�" "ç")
|
|
726 ("�" "è")
|
|
727 ("�" "é")
|
|
728 ("�" "ê")
|
|
729 ("�" "ë")
|
|
730 ("�" "ì")
|
|
731 ("�" "í")
|
|
732 ("�" "î")
|
|
733 ("�" "ï")
|
|
734 ("�" "ð")
|
|
735 ("�" "ñ")
|
|
736 ("�" "ò")
|
|
737 ("�" "ó")
|
|
738 ("�" "ô")
|
|
739 ("�" "õ")
|
|
740 ("�" "ö")
|
|
741 ("�" "ø")
|
|
742 ("�" "ù")
|
|
743 ("�" "ú")
|
|
744 ("�" "û")
|
|
745 ("�" "ü")
|
|
746 ("�" "ý")
|
|
747 ("�" "þ")
|
|
748 ("�" "ÿ")))
|
|
749
|
|
750 (defvar iso-sgml2iso-trans-tab
|
|
751 '(("À" "�")
|
|
752 ("Á" "�")
|
|
753 ("Â" "�")
|
|
754 ("Ã" "�")
|
|
755 ("Ä" "�")
|
|
756 ("Å" "�")
|
|
757 ("Æ" "�")
|
|
758 ("Ç" "�")
|
|
759 ("È" "�")
|
|
760 ("É" "�")
|
|
761 ("Ê" "�")
|
|
762 ("Ë" "�")
|
|
763 ("Ì" "�")
|
|
764 ("Í" "�")
|
|
765 ("Î" "�")
|
|
766 ("Ï" "�")
|
|
767 ("Ð" "�")
|
|
768 ("Ñ" "�")
|
|
769 ("Ò" "�")
|
|
770 ("Ó" "�")
|
|
771 ("Ô" "�")
|
|
772 ("Õ" "�")
|
|
773 ("Ö" "�")
|
|
774 ("Ø" "�")
|
|
775 ("Ù" "�")
|
|
776 ("Ú" "�")
|
|
777 ("Û" "�")
|
|
778 ("Ü" "�")
|
|
779 ("Ý" "�")
|
|
780 ("Þ" "�")
|
|
781 ("ß" "�")
|
|
782 ("à" "�")
|
|
783 ("á" "�")
|
|
784 ("â" "�")
|
|
785 ("ã" "�")
|
|
786 ("ä" "�")
|
|
787 ("å" "�")
|
|
788 ("æ" "�")
|
|
789 ("ç" "�")
|
|
790 ("è" "�")
|
|
791 ("é" "�")
|
|
792 ("ê" "�")
|
|
793 ("ë" "�")
|
|
794 ("ì" "�")
|
|
795 ("í" "�")
|
|
796 ("î" "�")
|
|
797 ("ï" "�")
|
|
798 ("ð" "�")
|
|
799 ("ñ" "�")
|
63102
|
800 (" " "�")
|
28393
|
801 ("ò" "�")
|
|
802 ("ó" "�")
|
|
803 ("ô" "�")
|
|
804 ("õ" "�")
|
|
805 ("ö" "�")
|
|
806 ("ø" "�")
|
|
807 ("ù" "�")
|
|
808 ("ú" "�")
|
|
809 ("û" "�")
|
|
810 ("ü" "�")
|
|
811 ("ý" "�")
|
|
812 ("þ" "�")
|
|
813 ("ÿ" "�")))
|
|
814
|
|
815 ;;;###autoload
|
|
816 (defun iso-iso2sgml (from to &optional buffer)
|
|
817 "Translate ISO 8859-1 characters in the region to SGML entities.
|
79378
|
818 Use entities from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\".
|
34753
|
819 Optional arg BUFFER is ignored (for use in `format-alist')."
|
28393
|
820 (interactive "*r")
|
|
821 (iso-translate-conventions from to iso-iso2sgml-trans-tab))
|
|
822
|
|
823 ;;;###autoload
|
|
824 (defun iso-sgml2iso (from to &optional buffer)
|
|
825 "Translate SGML entities in the region to ISO 8859-1 characters.
|
79378
|
826 Use entities from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\".
|
34753
|
827 Optional arg BUFFER is ignored (for use in `format-alist')."
|
28393
|
828 (interactive "*r")
|
|
829 (iso-translate-conventions from to iso-sgml2iso-trans-tab))
|
|
830
|
22911
|
831 ;;;###autoload
|
77673
|
832 (defun iso-cvt-read-only (&rest ignore)
|
22911
|
833 "Warn that format is read-only."
|
18228
|
834 (interactive)
|
|
835 (error "This format is read-only; specify another format for writing"))
|
|
836
|
22911
|
837 ;;;###autoload
|
77673
|
838 (defun iso-cvt-write-only (&rest ignore)
|
22911
|
839 "Warn that format is write-only."
|
18228
|
840 (interactive)
|
|
841 (error "This format is write-only"))
|
49598
|
842
|
22911
|
843 ;;;###autoload
|
18228
|
844 (defun iso-cvt-define-menu ()
|
58007
a8e3cd5a8156
(iso-cvt-define-menu): menu-bar-files-menu renamed to menu-bar-file-menu.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
845 "Add submenus to the File menu, to convert to and from various formats."
|
18228
|
846 (interactive)
|
|
847
|
58111
|
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))
|
79357
|
854
|
58111
|
855 (define-key menu [load-as-separator] '("--"))
|
18228
|
856
|
58111
|
857 (define-key menu [load-as] '("Load As..." . iso-cvt-load-as))
|
|
858 (fset 'iso-cvt-load-as load-as-menu-map)
|
7260
|
859
|
58111
|
860 ;;(define-key menu [insert-as] '("Insert As..." . iso-cvt-insert-as))
|
|
861 (fset 'iso-cvt-insert-as insert-as-menu-map)
|
18228
|
862
|
58111
|
863 (define-key menu [write-as] '("Write As..." . iso-cvt-write-as))
|
|
864 (fset 'iso-cvt-write-as write-as-menu-map)
|
18228
|
865
|
58111
|
866 (define-key menu [translate-separator] '("--"))
|
18228
|
867
|
58111
|
868 (define-key menu [translate-to] '("Translate to..." . iso-cvt-translate-to))
|
|
869 (fset 'iso-cvt-translate-to translate-to-menu-map)
|
|
870
|
|
871 (define-key menu [translate-from] '("Translate from..." . iso-cvt-translate-from))
|
|
872 (fset 'iso-cvt-translate-from translate-from-menu-map)
|
7260
|
873
|
58156
|
874 (dolist (file-type (reverse format-alist))
|
58111
|
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))))))))))
|
28393
|
904
|
|
905 (provide 'iso-cvt)
|
7260
|
906
|
58111
|
907 ;; arch-tag: 64ae843f-ed0e-43e1-ba50-ffd581b90840
|
7260
|
908 ;;; iso-cvt.el ends here
|