1# $Id: germanb.perl,v 1.13 1998/08/24 12:50:20 RRM Exp $
2# GERMAN.PERL by Nikos Drakos <nikos@cbl.leeds.ac.uk> 25-11-93
3# Computer Based Learning Unit, University of Leeds.
4#
5# Extension to LaTeX2HTML to translate LaTeX german special
6# commands to equivalent HTML commands.
7# Based on a patch to LaTeX2HTML supplied by  Franz Vojik
8# <vojik@de.tu-muenchen.informatik>.
9#
10# The original german.sty file was put together by H.Partl
11# (TU Wien) 4 Nov 1988
12#
13# Change Log:
14# ===========
15# $Log: germanb.perl,v $
16# Revision 1.13  1998/08/24 12:50:20  RRM
17#  --  updated for the new Babel capabilities
18#
19# Revision 1.11  1998/06/26 06:07:35  RRM
20#  --  put \n before intro message
21#
22# Revision 1.10  1998/04/28 13:10:05  latex2html
23#
24# Revision 1.9  1998/04/28 13:10:04  latex2html
25#  --  added new name:  $foot_title
26#
27# Revision 1.8  1998/02/22 05:27:07  latex2html
28# revised &german|french_titles
29#
30# Revision 1.7  1998/02/20 23:27:24  latex2html
31# added $GENERIC_WORDS
32#
33# Revision 1.6  1997/06/13 13:54:50  RRM
34#     Allow  &#34;  to be translated back into  \dq{}
35#
36# Revision 1.5  1997/06/06 12:49:09  RRM
37#  -  Fixed the handling of umlauts
38#  -  used ISO-Latin characters for `french quotes'
39#  -  changed version info
40#
41# Revision 1.4  1997/05/19 13:34:27  RRM
42#     Fixed a problem with umlauts.
43#
44# Revision 1.3  1996/12/23 01:39:55  JCL
45# o added informative comments and CVS log history
46# o changed usage of <date> to an OS independent construction, the
47#   patch is from Piet van Oostrum.
48#
49#
50# 11-JAN-94 Nikos Drakos: Modified the german specials array to
51#           deal with "` correctly
52# 25-JAN-94 Nikos Drakos: Replaced all the html special characters
53#           with their ;tex2html_html_special_mark_<chars> form
54# 13-Dec-94 Nikos Drakos Replaced ;tex2html_html_special_mark_<char>; with
55#           ;SPM<char>; to be consistent with changes in the main script
56# 19-Dec-95 Herb Swan: Removed _ from SPM... definitions, consistent with
57#	    with new math code of Marcus Hennecke.  Ignore '"|' and '"-'.
58# 23-May-97 Ross Moore: the " searches were out of order, so some cases
59#	    would never be found.
60#           Treat "s "z and "S "Z differently; thanks to  Marcus Harnisch.
61#           Replace non-special ;SPMquot; by  &#34;
62
63package german;
64#JKR: print a message.
65print "\ngerman style interface for LaTeX2HTML, revised: 23 May 1997\n";
66
67# Put german equivalents here for headings/dates/ etc when
68# latex2html start supporting them ...
69
70
71sub main'german_translation {
72    local($_) = @_;
73    s/;SPMquot;\s*(;SPMlt;|;SPMgt;|'|`|\\|-|=|;SPMquot;|\||~)/&get_german_specials($1)/geo;
74    local($next_char_rx) = &make_next_char_rx("[aAeEiIoOuU]");
75    s/$next_char_rx/&main'iso_map(($2||$3),"uml")/geo;
76#    $next_char_rx = &make_next_char_rx("[sSzZ]");
77    $next_char_rx = &make_next_char_rx("[sz]");
78    s/$next_char_rx/&main'iso_map("sz","lig")/geo;
79    $next_char_rx = &make_next_char_rx("[SZ]"); s/$next_char_rx/S$2/go;
80    s/;SPMquot;\s*([cflmnprt])/\1/go;
81#    s/;SPMquot;\s*([cflmnpt])/\1/go;
82#    s/;SPMquot;\s*(;SPMlt;|;SPMgt;|'|`|\\|-|;SPMquot;|\||~)/&get_german_specials($1)/geo;
83#    s/;SPMquot;/''/go;
84    s/;SPMquot;/&#34;/go;
85    $_;
86}
87
88sub main'do_cmd_3 {
89    join('',&main'iso_map("sz", "lig"),@_[0]);
90}
91
92sub make_next_char_rx {
93    local($chars) = @_;
94    local($OP,$CP) = &main'brackets;
95    ";SPMquot;\\s*(($chars)|$OP\\d+$CP\\s*($chars)\\s*$OP\\d+$CP)";
96}
97
98sub get_german_specials {
99    $german_specials{@_[0]}
100}
101
102%german_specials = (
103    '\'', "``",
104    "\`", ",,",
105    '\\', "",
106    '-', "",
107    '|', "",
108    ';SPMquot;', "",
109    '~', "-",
110    '=', "-"
111);
112
113if ($CHARSET =~ /iso_8859_2/) {
114    if ($HTML_VERSION > 2.1) {
115%german_specials = (
116      ';SPMlt;', '<SMALL>;SPMlt;;SPMlt;</SMALL>'
117    , ';SPMgt;', '<SMALL>&#62;&#62;</SMALL>'
118    , %german_specials );
119    } else {
120%german_specials = (
121      ';SPMlt;', ';SPMlt;;SPMlt;'
122    , ';SPMgt;', '&#62;&#62;'
123    , %german_specials );
124    }
125} else {
126%german_specials = (
127      ';SPMlt;', '&#171;'
128    , ';SPMgt;', '&#187;'
129    , %german_specials );
130}
131
132
133package main;
134
135if (defined &addto_languages) { &addto_languages('german') };
136
137sub do_cmd_flqq {
138    if ($CHARSET =~ /iso_8859_2/) {
139	if ($HTML_VERSION > 2.1) {
140	    join('', '<SMALL>;SPMlt;;SPMlt;</SMALL>',  @_[0]) }
141	else { join('',  ';SPMlt;;SPMlt;',  @_[0]) }
142    } else { join('',  '&#171;',  @_[0]) }
143}
144sub do_cmd_frqq {
145    if ($CHARSET =~ /iso_8859_2/) {
146	if ($HTML_VERSION > 2.1) {
147	    join('', '<SMALL>&#62;&#62;</SMALL>',  @_[0]) }
148	else { join('',  '&#62;&#62;',  @_[0]) }
149    } else { join('',  '&#187;',  @_[0]) }
150}
151sub do_cmd_flq {
152    if ($HTML_VERSION > 2.1) {
153	join('', '<SMALL>;SPMlt;</SMALL>',  @_[0]) }
154    else { join('',  ';SPMlt;',  @_[0]) }
155}
156sub do_cmd_frq {
157    if ($HTML_VERSION > 2.1) {
158	join('', '<SMALL>&#62;</SMALL>',  @_[0]) }
159    else { join('',  '&#62;',  @_[0]) }
160}
161sub do_cmd_glqq {
162    join('',  ",,",  @_[0]);};
163sub do_cmd_grqq {
164    join('',  "``",  @_[0]);};
165sub do_cmd_glq {
166    join('',  ",",  @_[0]);};
167sub do_cmd_grq {
168    join('',  "`",  @_[0]);};
169sub do_cmd_dq {
170#    join('',  "''",  @_[0]);};
171    join('',  '&#34;',  @_[0]);};
172
173sub do_cmd_germanTeX {
174    # Just in case we pass things to LaTeX
175    $default_language = 'german';
176    $latex_body .= "\\germanTeX\n";
177    @_[0];
178}
179
180sub do_cmd_originalTeX {
181    # Just in case we pass things to LaTeX
182    $default_language = 'original';
183    $latex_body .= "\\originalTeX\n";
184    @_[0];
185}
186
187#JKR: Prepare the german environment ...
188sub german_titles {
189    $toc_title = "Inhalt";
190    $lof_title = "Abbildungsverzeichnis";
191    $lot_title = "Tabellenverzeichnis";
192    $idx_title = "Index";
193    $ref_title = "Literaturverzeichnis";
194    $bib_title = "Literatur";
195    $abs_title = "Zusammenfassung";
196    $app_title = "Anhang";
197    $pre_title = "Vorwort";
198    $foot_title = "Fu&szlig;noten";
199    $thm_title = "Satz";
200    $fig_name = "Abbildung";
201    $tab_name = "Tabelle";
202    $prf_name = "Beweis";
203    $date_name = "Datum";
204    $page_name = "Seite";
205  #  Sectioning-level titles
206    $part_name = "Teil";
207    $chapter_name = "Kapitel";
208    $section_name = "Abschnitt";
209    $subsection_name = "Unterabschnitt";
210    $subsubsection_name = "Unter Unterabschnitt";
211    $paragraph_name = "Absatz";
212  #  Misc. strings
213    $child_name = "Unterabschnitte";
214    $info_title = "&Uuml;ber dieses Dokument ...";
215    $also_name = "siehe auch";
216    $see_name = "siehe";
217  #  names in navigation panels
218    $next_name = "N&auml;chste Seite";
219    $up_name = "Aufw&auml;rts";
220    $prev_name = "Vorherige Seite";
221    $group_name = "gruppe";
222  #  mail fields
223    $encl_name = "Anlage(n)";
224    $headto_name = "An";
225    $cc_name = "Verteiler";
226
227    @Month = ('', 'Januar', 'Februar', 'M&auml;rz', 'April', 'Mai',
228	      'Juni', 'Juli', 'August', 'September', 'Oktober',
229	      'November', 'Dezember');
230
231    local($uuml,$Uuml) = (&iso_map('u','uml'),&iso_map('U','uml'));
232    $GENERIC_WORDS =
233	join('|',"aber","oder","und","doch","um","in","im","an","am","${uuml}ber",
234	     "${Uuml}ber","unter","auf","durch","der","die","das","des","dem","den",
235	     "ein","eine","eines","einem","einen","einer","vor","nach","f${uuml}r",
236	     "mit","zu","zur","zum","bei","beim","per","von","vom","aus");
237}
238
239#JKR: Replace do_cmd_today (\today) with a nicer one, which is more
240# similar to the original.
241#JCL introduced &get_date
242sub german_today {
243    local($today) = &get_date;
244    $today =~ s|(\d+)/0?(\d+)/|$2. $Month[$1] |;
245    join('',$today,$_[0]);
246}
247
248# ... and use it.
249&german_titles;
250$default_language = 'german';
251$TITLES_LANGUAGE = "german";
252$german_encoding = 'iso-8859-1';
253
254# MEH: Make iso_latin1_character_map_inv use more appropriate code
255$iso_latin1_character_map_inv{'&#171;'} ='\\flqq';
256$iso_latin1_character_map_inv{'&#187;'} ='\\frqq';
257$iso_latin1_character_map_inv{'&#196;'} ='"A';
258$iso_latin1_character_map_inv{'&#214;'} ='"O';
259$iso_latin1_character_map_inv{'&#220;'} ='"U';
260$iso_latin1_character_map_inv{'&#228;'} ='"a';
261$iso_latin1_character_map_inv{'&#246;'} ='"o';
262$iso_latin1_character_map_inv{'&#223;'} ='"s';
263$iso_latin1_character_map_inv{'&#252;'} ='"u';
264$iso_latin1_character_map_inv{'&#34;'} ='\\dq{}';
265
2661;				# Not really necessary...
267
268
269
270