diff options
Diffstat (limited to 'contrib/texinfo/makeinfo/lang.c')
-rw-r--r-- | contrib/texinfo/makeinfo/lang.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/contrib/texinfo/makeinfo/lang.c b/contrib/texinfo/makeinfo/lang.c index 468bed80b1f0..a9cbfe1345e0 100644 --- a/contrib/texinfo/makeinfo/lang.c +++ b/contrib/texinfo/makeinfo/lang.c @@ -1,7 +1,7 @@ /* lang.c -- language-dependent support. - $Id: lang.c,v 1.14 2001/09/11 18:04:35 karl Exp $ + $Id: lang.c,v 1.5 2002/11/12 18:48:52 feloy Exp $ - Copyright (C) 1999, 2000, 01 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,6 +31,8 @@ encoding_code_type document_encoding_code = no_encoding; /* Current language code; default is English. */ language_code_type language_code = en; +iso_map_type us_ascii_map [] = {{NULL, 0, 0}}; /* ASCII map is trivial */ + /* Translation table between HTML and ISO Codes. The last item is hopefully the Unicode. It might be possible that those Unicodes are not correct, cause I didn't check them. kama */ @@ -131,16 +133,13 @@ iso_map_type iso8859_1_map [] = { { "uuml", 0xFC, 0x00FC }, { "yacute", 0xFD, 0x00FD }, { "thorn", 0xFE, 0x00FE }, - { "yuml", 0xFF, 0x00FF } + { "yuml", 0xFF, 0x00FF }, + { NULL, 0, 0 } }; -/* This might be put into structure below and NOT coded via define, - because some translation tables could contain different numbers of - characters, but for now it suffices. */ -#define ISO_MAP_SIZE (sizeof (iso8859_1_map) / sizeof (iso8859_1_map[0])) - encoding_type encoding_table[] = { { no_encoding, "(no encoding)", NULL }, + { US_ASCII, "US-ASCII", us_ascii_map }, { ISO_8859_1, "ISO-8859-1", (iso_map_type *) iso8859_1_map }, { ISO_8859_2, "ISO-8859-2", NULL }, { ISO_8859_3, "ISO-8859-3", NULL }, @@ -349,7 +348,7 @@ cm_search_iso_map (html) if (!iso) return -1; - for (i = 0; i < ISO_MAP_SIZE; i++) + for (i = 0; iso[i].html; i++) { if (strcmp (html, iso[i].html) == 0) return i; @@ -370,7 +369,7 @@ cm_documentencoding () get_rest_of_line (1, &enc_arg); /* See if we have this encoding. */ - for (enc = ISO_8859_1; enc != last_encoding_code; enc++) + for (enc = no_encoding+1; enc != last_encoding_code; enc++) { if (strcasecmp (enc_arg, encoding_table[enc].ecname) == 0) { @@ -400,8 +399,10 @@ add_encoded_char (html_str, info_str) char *html_str; char *info_str; { - if (html || xml) + if (html) add_word_args ("&%s;", html_str); + else if (xml) + xml_insert_entity (html_str); else if (enable_encoding) { /* Look for HTML_STR in the current translation table. */ @@ -439,15 +440,21 @@ cm_accent_generic_html (arg, start, end, html_supported, single, if (strchr (html_supported, curchar ())) { /* Yes; start with an ampersand. The character itself will be added later in read_command (makeinfo.c). */ + int saved_escape_html = escape_html; + escape_html = 0; valid_html_accent = 1; add_char ('&'); + escape_html = saved_escape_html; } else { valid_html_accent = 0; if (html_solo_standalone) { /* No special HTML support, so produce standalone char. */ - add_word_args ("&%s;", html_solo); + if (xml) + xml_insert_entity (html_solo); + else + add_word_args ("&%s;", html_solo); } else /* If the html_solo does not exist as standalone character |