]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/lilypond-texi2html.init
Fixed errors in Catalan translation
[lilypond.git] / Documentation / lilypond-texi2html.init
1 #!/usr/bin/env perl
2 # -*- coding: utf-8; -*-
3
4 ### texi2html customization script for LilyPond
5 ### Author: Reinhold Kainhofer <reinhold@kainhofer.com>, 2008.
6 ###         Some code parts copied from texi2html and adapted. These functions
7 ###         were written mainly by Patrice Dumas
8 ### License: GPLv3+
9 ###
10 ###
11 ### Features implemented here:
12 ### -) For split manuals, the main page is index.html.
13 ### -) All @unnumbered* sections are placed into the same file
14 ###    (implemented by split_at_numbered_sections)
15 ### -) Use our custom CSS file, with IE-specific fixes in another CSS file,
16 ###    implemented by lilypond_css_lines
17 ### -) TOC (folded, with the current page highlighted) in an overflown <div>
18 ###    is added to every page; implemented by:
19 ###           lilypond_print_element_header -- building of the TOC
20 ###           lilypond_toc_body -- generation of customized TOC output
21 ###           lilypond_print_page_head -- start <div id="main">
22 ###           print_lilypond_page_foot -- closing id=main, output of footer & TOC
23 ### -) External refs are formatted only as "Text of the node" (not as >>see
24 ###    "NODE" section "SECTION" in "BOOK"<< like with default texi2html). Also,
25 ###    the leading "(book-name)" is removed.
26 ###    Implemented by overriding lilypond_external_ref
27 ### -) Navigation bars on top/bottom of the page and between sections are not
28 ###    left-aligned, but use a combination of left/center/right aligned table
29 ###    cells; For this, I heavily extend the texi2html code to allow for
30 ###    differently aligned cells and for multi-line tables);
31 ###    Implemented in lilypond_print_navigation
32 ### -) Different formatting than the default: example uses the same formatting
33 ###    as quote.
34 ### -) Allow translated section titles: All section titles can be translated,
35 ###    the original (English) title is associated with @translationof. This is
36 ###    needed, because the file name / anchor is generated from the original
37 ###    English title, since otherwise language-autoselection would break with
38 ###    posted links.
39 ###    Since it is then no longer possible to obtain the file name from the
40 ###    section title, I keep a sectionname<=>filename/anchor around. This way,
41 ###    xrefs from other manuals can simply load that map and retrieve the
42 ###    correct file name for the link. Implemented in:
43 ###           lilypond_unknown (handling of @translationof, in case
44 ###                             extract_texi_filenames.py messes up...)
45 ###           lilypond_element_file_name (correct file name: use the map)
46 ###           lilypond_element_target_name (correct anchor: use the map)
47 ###           lilypond_init_map (read in the externally created map from disk)
48 ###           lilypond_external_href (load the map for xrefs, use the correct
49 ###                                   link target)
50 ### -) The HTML anchors for all sections are derived from the node name /
51 ###    section title (pre-generated in the .xref-map file). Implemented by:
52 ###           lilypond_element_target_name (adjust section anchors)
53 ### -) Use the standard footnote format "<sup>nr</sup> text" instead of the
54 ###    ugly format of texi2html (<h3>(nr)</h3><p>text</p>). Implemented in
55 ###           makeinfo_like_foot_line_and_ref
56 ###           makeinfo_like_foot_lines
57 ###           makeinfo_like_paragraph
58 ### -) In tables, don't wrap <p> around the contents. Implemented in
59 ###           makeinfo_like_paragraph
60 ###
61 ###
62 ### Useful helper functions:
63 ### -) texinfo_file_name($node_name): returns a texinfo-compatible file name
64 ###    for the given string $node_name (whitespace trimmed/replaced by -,
65 ###    non-standard chars replaced by _xxxx (ascii char code) and forced to
66 ###    start with a letter by prepending t_g if necessary)
67
68 package main;
69 $original_normalise_node = \&normalise_node;
70
71 sub t2h_default_normalise_node($)
72 {
73     my $text = shift;
74     $original_normalise_node->($text);
75 }
76
77 *normalise_node = sub($)
78 {
79     my $text = shift;
80     return &$Texi2HTML::Config::normalise_node($text);
81 };
82
83 package Texi2HTML::Config;
84 ##$normalise_node = \&t2h_default_normalise_node;
85 $normalise_node = \&lilypond_normalise_node;
86
87
88 use utf8;
89 use Encode qw(decode);
90
91 #############################################################################
92 ### TRANSLATIONS
93 #############################################################################
94
95 my $LY_LANGUAGES = {};
96 $LY_LANGUAGES->{'ca'} = {
97     'Back to Documentation Index' => '',
98     '<p>Thanks to ${webdev_link} for hosting ${lily_site}.' => '',
99 };
100
101 $LY_LANGUAGES->{'cs'} = {
102     'Back to Documentation Index' => '',
103     '<p>Thanks to ${webdev_link} for hosting ${lily_site}.' => '',
104 };
105
106 $LY_LANGUAGES->{'de'} = {
107     'Back to Documentation Index' => 'Zur Dokumentationsübersicht',
108     '<p>Thanks to ${webdev_link} for hosting ${lily_site}.' => '',
109 };
110
111 $LY_LANGUAGES->{'es'} = {
112     'Back to Documentation Index' => 'Volver al índice de la documentación',
113     '<p>Thanks to ${webdev_link} for hosting ${lily_site}.' => '<p>Agradecemos a ${webdev_link} el alojamiento de ${lily_site}.',
114 };
115
116 $LY_LANGUAGES->{'fr'} = {
117     'Back to Documentation Index' => 'Retour à l\'accueil de la documentation',
118     '<p>Thanks to ${webdev_link} for hosting ${lily_site}.' => '<p>Remerciements à ${webdev_link} pour l\'hébergement de ${lily_site}.',
119 };
120
121
122 $LY_LANGUAGES->{'hu'} = {
123     'Back to Documentation Index' => 'Vissza a dokumentációk jegyzékéhez',
124     '<p>Thanks to ${webdev_link} for hosting ${lily_site}.' => '<p>Köszönet a ${webdev_link} részére a ${lily_site} tárhelyért.',
125 };
126
127 $LY_LANGUAGES->{'it'} = {
128     'Back to Documentation Index' => 'Torna all\'indice della documentazione',
129     '<p>Thanks to ${webdev_link} for hosting ${lily_site}.' => 'Grazie a ${webdev_link} per l\'hosting di ${lily_site}.',
130 };
131
132 $LY_LANGUAGES->{'ja'} = {
133     'Back to Documentation Index' => 'ドキュメント インデックスに戻る',
134     '<p>Thanks to ${webdev_link} for hosting ${lily_site}.' => '<p>${lily_site} をホスティングしてくれている ${webdev_link} に感謝します。',
135 };
136
137
138 $LY_LANGUAGES->{'nl'} = {
139     'Back to Documentation Index' => 'Terug naar de Documentatieindex',
140     '<p>Thanks to ${webdev_link} for hosting ${lily_site}.' => '<p>Met dank aan ${webdev_link} voor het hosten van ${lily_site}.',
141 };
142
143 $LY_LANGUAGES->{'zh'} = {
144     'Back to Documentation Index' => '回到文档索引',
145     '<p>Thanks to ${webdev_link} for hosting ${lily_site}.' => '<p>非常感谢 ${webdev_link} 提供 ${lily_site} 的主机空间。',
146 };
147
148 # FIXME: request the translations below then send them to texi2html/texinfo devs
149
150 $LANGUAGES->{'it'} = {
151                        '  The buttons in the navigation panels have the following meaning:' => '  I bottoni nei pannelli di navigazione hanno il seguente significato:',
152                        '  where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => '  dove @strong{ Esempio } assume che l\'attuale posizione è alla @strong{ Sottosottosezione Uno-Due-Tre } di un documento che ha la seguente struttura:',
153                        ' Up ' => ' Su ',
154                        '(outside of any element)' => '(fuori da qualsiasi elemento)',
155                        '(outside of any node)' => '(fuori da qualsiasi nodo)',
156                        '@b{{quotation_arg}:} ' => '@b{{quotation_arg}:} ',
157                        '@cite{{book}}' => '@cite{{book}}',
158                        '@{No value for `{value}\'@}' => '@{Nessun valore per `{value}\'@}',
159                        'About' => 'Informazioni',
160                        'About (help)' => 'Informazioni (aiuto)',
161                        'About This Document' => 'Informazioni su questo documento',
162                        'April' => 'Aprile',
163                        'August' => 'Agosto',
164                        'Back' => 'Indietro',
165                        'Back section in previous file' => '',
166                        'Beginning of this chapter or previous chapter' => 'Inizio di questo capitolo o capitolo precedente',
167                        'Button' => 'Bottone',
168                        'Contents' => 'Contenuti',
169                        'Cover (top) of document' => 'Copertina (inizio) del documento',
170                        'Current' => 'Attuale',
171                        'Current Position' => 'Posizione Attuale',
172                        'Current section' => 'Sezione attuale',
173                        'December' => 'Dicembre',
174                        'FastBack' => 'Indietro veloce',
175                        'FastForward' => 'Avanti veloce',
176                        'February' => 'Febbraio',
177                        'First' => 'Primo',
178                        'First section in reading order' => 'Prima sezione in ordine di lettura',
179                        'Following' => 'Seguente',
180                        'Following node' => 'Nodo seguente',
181                        'Footnotes' => 'Note a piè di pagina',
182                        'Forward' => 'Avanti',
183                        'Forward section in next file' => 'Sezione successiva nel prossimo file',
184                        'From 1.2.3 go to' => 'Da 1.2.3 vai a',
185                        'Go to' => 'Vai a',
186                        'Index' => 'Indice',
187                        'Index Entry' => 'Voce dell\'indice',
188                        'January' => 'Gennaio',
189                        'July' => 'Luglio',
190                        'Jump to' => 'Salta a',
191                        'June' => 'Giugno',
192                        'Last' => 'Ultimo',
193                        'Last section in reading order' => 'Ultima sezione in ordine di lettura',
194                        'March' => 'Marzo',
195                        'May' => 'Maggio',
196                        'Menu:' => 'Menu',
197                        'Name' => 'Nome',
198                        'Next' => 'Successivo',
199                        'Next chapter' => 'Capitolo successivo',
200                        'Next file' => 'File successivo',
201                        'Next node' => 'Nodo successivo',
202                        'Next section in reading order' => 'Sezione successiva in ordine di lettura',
203                        'Next section on same level' => 'Sezione successiva sullo stesso livello',
204                        'NextFile' => 'File successivo',
205                        'Node following in node reading order' => 'Nodo seguente in ordine di lettura',
206                        'Node up' => 'Nodo superiore',
207                        'NodeNext' => 'Nodo successivo',
208                        'NodePrev' => 'Nodo precedente',
209                        'NodeUp' => 'Nodo superiore',
210                        'November' => 'Novembre',
211                        'October' => 'Ottobre',
212                        'Overview' => 'Panoramica',
213                        'Prev' => 'Prec.',
214                        'PrevFile' => 'File precedente',
215                        'Previous' => 'Precedente',
216                        'Previous file' => 'File precedente',
217                        'Previous node' => 'Nodo precedente',
218                        'Previous section in reading order' => 'Sezione precedente in ordine di lettura',
219                        'Previous section on same level' => 'Sezione precedente sullo stesso livello',
220                        'Section' => 'Sezione',
221                        'Section One' => 'Sezione uno',
222                        'See ' => 'Vedi',
223                        'See @cite{{book}}' => 'Vedi @cite{{book}}',
224                        'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'Vedi la sezione `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}',
225                        'See section `{section}\' in @cite{{book}}' => 'Vedi la sezione `{section}\' in @cite{{book}}',
226                        'See section {reference_name}' => 'Vedi la sezione {reference_name}',
227                        'See {node_file_href}' => 'Vedi {node_file_href}',
228                        'See {node_file_href} @cite{{book}}' => 'Vedi {node_file_href} @cite{{book}}',
229                        'See {node_file_href} section `{section}\' in @cite{{book}}' => 'Vedi {node_file_href} nella sezione `{section}\' in @cite{{book}}',
230                        'See {reference_name}' => 'Vedi {reference_name}',
231                        'See {ref}' => 'Vedi {ref}',
232                        'See {title_ref}' => 'Vedi {title_ref}',
233                        'September' => 'Settembre',
234                        'Short Table of Contents' => 'Indice breve',
235                        'Short table of contents' => 'Indice breve',
236                        'Subsection One-Four' => 'Sottosezione Uno-Quattro',
237                        'Subsection One-One' => 'Sottosezione Uno-Uno',
238                        'Subsection One-Three' => 'Sottosezione Uno-Tre',
239                        'Subsection One-Two' => 'Sottosezione Uno-Due',
240                        'Subsubsection One-Two-Four' => 'Sottosottosezione Uno-Due-Quattro',
241                        'Subsubsection One-Two-One' => 'Sottosottosezione Uno-Due-Uno',
242                        'Subsubsection One-Two-Three' => 'Sottosottosezione Uno-Due-Tre',
243                        'Subsubsection One-Two-Two' => 'Sottosottosezione Uno-Due-Due',
244                        'T2H_today' => '%s, %d %d',
245                        'Table of Contents' => 'Indice',
246                        'Table of contents' => 'Indice',
247                        'The node you are looking for is at {href}.' => 'Il nodo che stai cercando è {href}',
248                        'This' => 'Questo',
249                        'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => 'Questo documento è stato generato il @i{{date}} con @uref{{program_homepage}, @i{{program}}}.',
250                        'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => 'Questo documento è stato generato con @uref{{program_homepage}, @emph{{program}}}.',
251                        'Top' => 'Inizio',
252                        'Untitled Document' => 'Documento senza titolo',
253                        'Up' => 'Su',
254                        'Up node' => 'Nodo superiore',
255                        'Up section' => 'Sezione superiore',
256                        'current' => 'attuale',
257                        'on @emph{{date}}' => 'il @emph{{date}}',
258                        'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'sezione `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}',
259                        'section `{section}\' in @cite{{book}}' => 'sezione `{section}\' in @cite{{book}}',
260                        'see ' => 'vedi ',
261                        'see @cite{{book}}' => 'vedi @cite{{book}}',
262                        'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'vedi la sezione `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}',
263                        'see section `{section}\' in @cite{{book}}' => 'vedi la sezione `{section}\' in @cite{{book}}',
264                        'see section {reference_name}' => 'vedi la sezione {reference_name}',
265                        'see {node_file_href}' => 'vedi {node_file_href}',
266                        'see {node_file_href} @cite{{book}}' => 'vedi {node_file_href} @cite{{book}}',
267                        'see {node_file_href} section `{section}\' in @cite{{book}}' => 'vedi {node_file_href} nella sezione `{section}\' in @cite{{book}}',
268                        'see {reference_name}' => 'vedi {reference_name}',
269                        'see {ref}' => 'vedi {ref}',
270                        'see {title_ref}' => 'vedi {title_ref}',
271                        '{acronym_like} ({explanation})' => '{acronym_like} ({explanation})',
272                        '{name} of {class}' => '{name} di {class}',
273                        '{name} on {class}' => '{name} in {class}',
274                        '{node_file_href}' => '{node_file_href}',
275                        '{node_file_href} @cite{{book}}' => '{node_file_href} @cite{{book}}',
276                        '{node_file_href} section `{section}\' in @cite{{book}}' => '{node_file_href} nella sezione `{section}\' in @cite{{book}}',
277                        '{reference_name}' => '{reference_name}',
278                        '{ref}' => '{ref}',
279                        '{style} {number}' => '{style} {number}',
280                        '{style}: {caption_first_line}' => '{style}: {caption_first_line}',
281                        '{style}: {shortcaption_first_line}' => '{style}: {shortcaption_first_line}',
282                        '{title_ref}' => '{title_ref}'
283                      };
284
285 $LANGUAGES->{'hu'} = {
286                        '  The buttons in the navigation panels have the following meaning:' => '  A navigációs panelen levő gombok jelentése a következő:',
287                        '  where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => '  @strong{ Példánkban } az aktuális pozíció az @strong{ 1.2.3 alalszakasz } egy olyan dokumentumban, melynek szerkezete a következő:',
288                        ' Up ' => 'Fel',
289                        '(outside of any element)' => '(bármelyik elemen kívül)',
290                        '(outside of any node)' => '(bármelyik csomóponton kívül)',
291                        '@b{{quotation_arg}:} ' => '@b{{quotation_arg}:} ',
292                        '@cite{{book}}' => '@cite{{book}}',
293                        '@{No value for `{value}\'@}' => '@{Nincs értéke ennek: `{value}\'@}',
294                        'About' => 'Súgó',
295                        'About (help)' => 'Segítség a navigációhoz',
296                        'About This Document' => 'A navigációs panel használata',
297                        'April' => 'április',
298                        'August' => 'augusztus',
299                        'Back' => 'Vissza',
300                        'Back section in previous file' => 'Előző fájl hátsó szakasza',
301                        'Beginning of this chapter or previous chapter' => 'Fejezet eleje vagy előző fejezet',
302                        'Button' => 'Gomb',
303                        'Contents' => 'Tartalom',
304                        'Cover (top) of document' => 'Dokumentum címoldala',
305                        'Current' => 'Aktuális',
306                        'Current Position' => 'Aktuális pozíció',
307                        'Current section' => 'Aktuális szakasz',
308                        'December' => 'december',
309                        'FastBack' => 'Visszaugrás',
310                        'FastForward' => 'Előreugrás',
311                        'February' => 'február',
312                        'First' => 'Első',
313                        'First section in reading order' => 'Első szakasz az olvasási sorrendben',
314                        'Following' => 'Következő',
315                        'Following node' => 'Következő csomópont',
316                        'Footnotes' => 'Lábjegyzet',
317                        'Forward' => 'Előre',
318                        'Forward section in next file' => 'Következő fájl elülső szakasza',
319                        'From 1.2.3 go to' => '1.2.3-ból ide jutunk',
320                        'Go to' => 'Cél',
321                        'Index' => 'Tárgymutató',
322                        'Index Entry' => 'Tárgymutató-bejegyzés',
323                        'January' => 'január',
324                        'July' => 'július',
325                        'Jump to' => 'Ugorj ide',
326                        'June' => 'június',
327                        'Last' => 'Utolsó',
328                        'Last section in reading order' => 'Utolsó szakasz az olvasási sorrendben',
329                        'March' => 'március',
330                        'May' => 'május',
331                        'Menu:' => 'Menü:',
332                        'Name' => 'Név',
333                        'Next' => 'Következő',
334                        'Next chapter' => 'Következő fejezet',
335                        'Next file' => 'Következő fájl',
336                        'Next node' => 'Következő csomópont',
337                        'Next section in reading order' => 'Következő szakasz az olvasási sorrendben',
338                        'Next section on same level' => 'Következő szakasz ugyanazon a szinten',
339                        'NextFile' => 'KövetkezőFájl',
340                        'Node following in node reading order' => 'Következő csomópont az olvasási sorrendben',
341                        'Node up' => 'Szülő csomópont',
342                        'NodeNext' => 'KövetkezőCsomópont',
343                        'NodePrev' => 'ElőzőCsomópont',
344                        'NodeUp' => 'SzülőCsomópont',
345                        'November' => 'november',
346                        'October' => 'október',
347                        'Overview' => 'Áttekintés',
348                        'Prev' => 'Előző',
349                        'PrevFile' => 'ElőzőFájl',
350                        'Previous' => 'Előző',
351                        'Previous file' => 'Előző fájl',
352                        'Previous node' => 'Előző csomópont',
353                        'Previous section in reading order' => 'Előző szakasz az olvasási sorrendben',
354                        'Previous section on same level' => 'Előző szakasz ugyanazon a szinten',
355                        'Section' => 'Szakasz',
356                        'Section One' => 'szakasz',
357                        'See ' => 'Ld. ',
358                        'See @cite{{book}}' => 'Ld. @cite{{book}}',
359                        'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'Ld. ezt a szakaszt: `@asis{}`{section_name}\'@asis{}\' itt: @cite{{book}}',
360                        'See section `{section}\' in @cite{{book}}' => 'Ld. ezt a szakaszt: `{section}\' itt: @cite{{book}}',
361                        'See section {reference_name}' => 'Ld. ezt a szakaszt: {reference_name}',
362                        'See {node_file_href}' => 'Ld. {node_file_href}',
363                        'See {node_file_href} @cite{{book}}' => 'See {node_file_href} @cite{{book}}',
364                        'See {node_file_href} section `{section}\' in @cite{{book}}' => 'Ld. {node_file_href} ezt a szakaszt: `{section}\' itt: @cite{{book}}',
365                        'See {reference_name}' => 'Ld. {reference_name}',
366                        'See {ref}' => 'Ld. {ref}',
367                        'See {title_ref}' => 'Ld. {title_ref}',
368                        'September' => 'szeptember',
369                        'Short Table of Contents' => 'Rövid tartalomjegyzék',
370                        'Short table of contents' => 'Rövid tartalomjegyzék',
371                        'Subsection One-Four' => 'alszakasz',
372                        'Subsection One-One' => 'alszakasz',
373                        'Subsection One-Three' => 'alszakasz',
374                        'Subsection One-Two' => 'alszakasz',
375                        'Subsubsection One-Two-Four' => 'alalszakasz',
376                        'Subsubsection One-Two-One' => 'alalszakasz',
377                        'Subsubsection One-Two-Three' => 'alalszakasz',
378                        'Subsubsection One-Two-Two' => 'alalszakasz',
379                        'T2H_today' => '%s, %d %d',
380                        'Table of Contents' => 'Tartalomjegyzék',
381                        'Table of contents' => 'Tartalomjegyzék',
382                        'The node you are looking for is at {href}.' => 'A keresett csomópont itt található: {href}.',
383                        'This' => 'Ez a(z)',
384                        'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => 'Ezt a dokumentumot @i{{date}} napon generálta a(z) @uref{{program_homepage}, @i{{program}}}.',
385                        'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => 'Ezt a dokumentumot a(z) @uref{{program_homepage}, @emph{{program}}} generálta.',
386                        'Top' => 'Címoldal',
387                        'Untitled Document' => 'Névtelen dokumentum',
388                        'Up' => 'Fel',
389                        'Up node' => 'Szülő csomópont',
390                        'Up section' => 'Szülő szakasz',
391                        'current' => 'aktuális',
392                        'on @emph{{date}}' => 'ekkor: @emph{{date}}',
393                        'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'szakasz: `@asis{}`{section_name}\'@asis{}\' itt: @cite{{book}}',
394                        'section `{section}\' in @cite{{book}}' => 'szakasz: `{section}\' itt: @cite{{book}}',
395                        'see ' => 'ld. ',
396                        'see @cite{{book}}' => 'ld. @cite{{book}}',
397                        'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'ld. ezt a szakaszt: `@asis{}`{section_name}\'@asis{}\' itt: @cite{{book}}',
398                        'see section `{section}\' in @cite{{book}}' => 'ld. ezt a szakaszt: `{section}\' itt: @cite{{book}}',
399                        'see section {reference_name}' => 'ld. ezt a szakaszt: {reference_name}',
400                        'see {node_file_href}' => 'ld. {node_file_href}',
401                        'see {node_file_href} @cite{{book}}' => 'ld. {node_file_href} @cite{{book}}',
402                        'see {node_file_href} section `{section}\' in @cite{{book}}' => 'ld. {node_file_href} ezt a szakaszt: `{section}\' itt: @cite{{book}}',
403                        'see {reference_name}' => 'ld. {reference_name}',
404                        'see {ref}' => 'ld. {ref}',
405                        'see {title_ref}' => 'ld. {title_ref}',
406                        '{acronym_like} ({explanation})' => '{acronym_like} ({explanation})',
407                        '{name} of {class}' => '{name} típusa: {class}',
408                        '{name} on {class}' => '{name} ezen: {class}',
409                        '{node_file_href}' => '{node_file_href}',
410                        '{node_file_href} @cite{{book}}' => '{node_file_href} @cite{{book}}',
411                        '{node_file_href} section `{section}\' in @cite{{book}}' => '{node_file_href} szakasz: `{section}\' itt: @cite{{book}}',
412                        '{reference_name}' => '{reference_name}',
413                        '{ref}' => '{ref}',
414                        '{style} {number}' => '{style} {number}',
415                        '{style}: {caption_first_line}' => '{style}: {caption_first_line}',
416                        '{style}: {shortcaption_first_line}' => '{style}: {shortcaption_first_line}',
417                        '{title_ref}' => '{title_ref}'
418                      };
419
420 $LANGUAGES->{'ja'} = {
421                        '  The buttons in the navigation panels have the following meaning:' => '  ナビゲーション パネルの中にあるボタンには以下のような意味があります:',
422                        '  where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => '  この表で、@strong{ 行き先 } は、現在の位置が以下のような構造を持つドキュメントの @strong{ サブサブセクション 1-2-3 } であると仮定しています:',
423                        ' Up ' => ' 上へ ',
424                        '(outside of any element)' => '(outside of any element)',
425                        '(outside of any node)' => '(outside of any node)',
426                        '@b{{quotation_arg}:} ' => '@b{{quotation_arg}:} ',
427                        '@cite{{book}}' => '@cite{{book}}',
428                        '@{No value for `{value}\'@}' => '@{No value for `{value}\'@}',
429                        'About' => '情報',
430                        'About (help)' => '情報 (ヘルプ)',
431                        'About This Document' => 'このドキュメントについて',
432                        'April' => '4 月',
433                        'August' => '8 月',
434                        'Back' => '戻る',
435                        'Back section in previous file' => '前のファイルのセクションに戻る',
436                        'Beginning of this chapter or previous chapter' => 'この章あるいは前の章の先頭',
437                        'Button' => 'ボタン',
438                        'Contents' => '目次',
439                        'Cover (top) of document' => 'ドキュメントの表紙 (先頭)',
440                        'Current' => '現在の',
441                        'Current Position' => '現在の位置',
442                        'Current section' => '現在のセクション',
443                        'December' => '12 月',
444                        'FastBack' => '大きく戻る',
445                        'FastForward' => '大きく進む',
446                        'February' => '2 月',
447                        'First' => '最初',
448                        'First section in reading order' => '最初のセクション',
449                        'Following' => '次',
450                        'Following node' => '次のノード',
451                        'Footnotes' => '脚注',
452                        'Forward' => '進む',
453                        'Forward section in next file' => '次のファイルのセクションに進む',
454                        'From 1.2.3 go to' => '1.2.3 からの行き先',
455                        'Go to' => '行き先',
456                        'Index' => 'インデックス',
457                        'Index Entry' => 'インデックス エントリ',
458                        'January' => '1 月',
459                        'July' => '7 月',
460                        'Jump to' => '行き先',
461                        'June' => '6月',
462                        'Last' => '最後',
463                        'Last section in reading order' => '最後のセクション',
464                        'March' => '3 月',
465                        'May' => '5 月',
466                        'Menu:' => 'メニュー',
467                        'Name' => '名前',
468                        'Next' => '次',
469                        'Next chapter' => '次の章',
470                        'Next file' => '次のファイル',
471                        'Next node' => '次のノード',
472                        'Next section in reading order' => '次のセクション',
473                        'Next section on same level' => '次のセクション',
474                        'NextFile' => '次のファイル',
475                        'Node following in node reading order' => '次のノード',
476                        'Node up' => '上のノード',
477                        'NodeNext' => '次のノード',
478                        'NodePrev' => '前のノード',
479                        'NodeUp' => '上のノード',
480                        'November' => '11 月',
481                        'October' => '10 月',
482                        'Overview' => '概要',
483                        'Prev' => '前',
484                        'PrevFile' => '前のファイル',
485                        'Previous' => '前の',
486                        'Previous file' => '前のファイル',
487                        'Previous node' => '前のノード',
488                        'Previous section in reading order' => '前のセクション',
489                        'Previous section on same level' => '前のセクション',
490                        'Section' => 'セクション',
491                        'Section One' => 'セクション 1',
492                        'See ' => '参照',
493                        'See @cite{{book}}' => '@cite{{book}} を参照してください',
494                        'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '@cite{{book}} のセクション `@asis{}`{section_name}\'@asis{}\' を参照してください',
495                        'See section `{section}\' in @cite{{book}}' => '@cite{{book}} のセクション `{section}\' を参照してください',
496                        'See section {reference_name}' => 'セクション {reference_name} を参照してください',
497                        'See {node_file_href}' => '{node_file_href} を参照してください',
498                        'See {node_file_href} @cite{{book}}' => '@cite{{book}} の {node_file_href} を参照してください',
499                        'See {node_file_href} section `{section}\' in @cite{{book}}' => '@cite{{book}} の {node_file_href} セクション `{section}\' を参照してください',
500                        'See {reference_name}' => '{reference_name} を参照してください',
501                        'See {ref}' => '{ref} を参照してください',
502                        'See {title_ref}' => '{title_ref} を参照してください',
503                        'September' => '9 月',
504                        'Short Table of Contents' => '簡単な目次',
505                        'Short table of contents' => '簡単な目次',
506                        'Subsection One-Four' => 'サブセクション 1-4',
507                        'Subsection One-One' => 'サブセクション 1-1',
508                        'Subsection One-Three' => 'サブセクション 1-3',
509                        'Subsection One-Two' => 'サブセクション 1-2',
510                        'Subsubsection One-Two-Four' => 'サブサブセクション 1-2-4',
511                        'Subsubsection One-Two-One' => 'サブサブセクション 1-2-1',
512                        'Subsubsection One-Two-Three' => 'サブサブセクション 1-2-3',
513                        'Subsubsection One-Two-Two' => 'サブサブセクション 1-2-2',
514                        'T2H_today' => '%s, %d %d',
515                        'Table of Contents' => '目次',
516                        'Table of contents' => '目次',
517                        'The node you are looking for is at {href}.' => 'あなたが探しているノードは {href} にあります。',
518                        'This' => 'この',
519                        'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => 'このドキュメントは @i{{date}} に、@uref{{program_homepage}, @i{{program}}} を用いて生成されました。',
520                        'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => 'このドキュメントは @uref{{program_homepage}, @emph{{program}}} を用いて生成されました。',
521                        'Top' => 'トップ',
522                        'Untitled Document' => '無題のドキュメント',
523                        'Up' => '上',
524                        'Up node' => '上のノード',
525                        'Up section' => '上のセクション',
526                        'current' => '現在の',
527                        'on @emph{{date}}' => '@emph{{date}} に',
528                        'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '@cite{{book}} のセクション `@asis{}`{section_name}\'@asis{}\'',
529                        'section `{section}\' in @cite{{book}}' => '@cite{{book}} のセクション `{section}\'',
530                        'see ' => '参照',
531                        'see @cite{{book}}' => '@cite{{book}} を参照してください',
532                        'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '@cite{{book}} のセクション `@asis{}`{section_name}\'@asis{}\' を参照してください',
533                        'see section `{section}\' in @cite{{book}}' => '@cite{{book}} のセクション `{section}\' を参照してください',
534                        'see section {reference_name}' => 'セクション {reference_name} を参照してください',
535                        'see {node_file_href}' => '{node_file_href} を参照してください',
536                        'see {node_file_href} @cite{{book}}' => '{node_file_href} @cite{{book}} を参照してください',
537                        'see {node_file_href} section `{section}\' in @cite{{book}}' => '@cite{{book}} の {node_file_href} section `{section}\' を参照してください',
538                        'see {reference_name}' => '{reference_name} を参照してください',
539                        'see {ref}' => '{ref} を参照してくださ',
540                        'see {title_ref}' => '{title_ref} を参照してくださ',
541                        '{acronym_like} ({explanation})' => '{acronym_like} ({explanation})',
542                        '{name} of {class}' => '{class} の {name}',
543                        '{name} on {class}' => '{class} の {name}',
544                        '{node_file_href}' => '{node_file_href}',
545                        '{node_file_href} @cite{{book}}' => '{node_file_href} @cite{{book}}',
546                        '{node_file_href} section `{section}\' in @cite{{book}}' => '@cite{{book}} の {node_file_href} セクション `{section}\'',
547                        '{reference_name}' => '{reference_name}',
548                        '{ref}' => '{ref}',
549                        '{style} {number}' => '{style} {number}',
550                        '{style}: {caption_first_line}' => '{style}: {caption_first_line}',
551                        '{style}: {shortcaption_first_line}' => '{style}: {shortcaption_first_line}',
552                        '{title_ref}' => '{title_ref}'
553                      };
554
555 $LANGUAGES->{'cs'} = {
556                        '  The buttons in the navigation panels have the following meaning:' => '',
557                        '  where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => '',
558                        ' Up ' => '',
559                        '(outside of any element)' => '',
560                        '(outside of any node)' => '',
561                        '@b{{quotation_arg}:} ' => '',
562                        '@cite{{book}}' => '',
563                        '@{No value for `{value}\'@}' => '',
564                        'About' => '',
565                        'About (help)' => '',
566                        'About This Document' => '',
567                        'April' => '',
568                        'August' => '',
569                        'Back' => '',
570                        'Back section in previous file' => '',
571                        'Beginning of this chapter or previous chapter' => '',
572                        'Button' => '',
573                        'Contents' => '',
574                        'Cover (top) of document' => '',
575                        'Current' => '',
576                        'Current Position' => '',
577                        'Current section' => '',
578                        'December' => '',
579                        'FastBack' => '',
580                        'FastForward' => '',
581                        'February' => '',
582                        'First' => '',
583                        'First section in reading order' => '',
584                        'Following' => '',
585                        'Following node' => '',
586                        'Footnotes' => '',
587                        'Forward' => '',
588                        'Forward section in next file' => '',
589                        'From 1.2.3 go to' => '',
590                        'Go to' => '',
591                        'Index' => '',
592                        'Index Entry' => '',
593                        'January' => '',
594                        'July' => '',
595                        'Jump to' => '',
596                        'June' => '',
597                        'Last' => '',
598                        'Last section in reading order' => '',
599                        'March' => '',
600                        'May' => '',
601                        'Menu:' => '',
602                        'Name' => '',
603                        'Next' => '',
604                        'Next chapter' => '',
605                        'Next file' => '',
606                        'Next node' => '',
607                        'Next section in reading order' => '',
608                        'Next section on same level' => '',
609                        'NextFile' => '',
610                        'Node following in node reading order' => '',
611                        'Node up' => '',
612                        'NodeNext' => '',
613                        'NodePrev' => '',
614                        'NodeUp' => '',
615                        'November' => '',
616                        'October' => '',
617                        'Overview' => '',
618                        'Prev' => '',
619                        'PrevFile' => '',
620                        'Previous' => '',
621                        'Previous file' => '',
622                        'Previous node' => '',
623                        'Previous section in reading order' => '',
624                        'Previous section on same level' => '',
625                        'Section' => '',
626                        'Section One' => '',
627                        'See ' => '',
628                        'See @cite{{book}}' => '',
629                        'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
630                        'See section `{section}\' in @cite{{book}}' => '',
631                        'See section {reference_name}' => '',
632                        'See {node_file_href}' => '',
633                        'See {node_file_href} @cite{{book}}' => '',
634                        'See {node_file_href} section `{section}\' in @cite{{book}}' => '',
635                        'See {reference_name}' => '',
636                        'See {ref}' => '',
637                        'See {title_ref}' => '',
638                        'September' => '',
639                        'Short Table of Contents' => '',
640                        'Short table of contents' => '',
641                        'Subsection One-Four' => '',
642                        'Subsection One-One' => '',
643                        'Subsection One-Three' => '',
644                        'Subsection One-Two' => '',
645                        'Subsubsection One-Two-Four' => '',
646                        'Subsubsection One-Two-One' => '',
647                        'Subsubsection One-Two-Three' => '',
648                        'Subsubsection One-Two-Two' => '',
649                        'T2H_today' => '',
650                        'Table of Contents' => '',
651                        'Table of contents' => '',
652                        'The node you are looking for is at {href}.' => '',
653                        'This' => '',
654                        'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => '',
655                        'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => '',
656                        'Top' => '',
657                        'Untitled Document' => '',
658                        'Up' => '',
659                        'Up node' => '',
660                        'Up section' => '',
661                        'current' => '',
662                        'on @emph{{date}}' => '',
663                        'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
664                        'section `{section}\' in @cite{{book}}' => '',
665                        'see ' => '',
666                        'see @cite{{book}}' => '',
667                        'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
668                        'see section `{section}\' in @cite{{book}}' => '',
669                        'see section {reference_name}' => '',
670                        'see {node_file_href}' => '',
671                        'see {node_file_href} @cite{{book}}' => '',
672                        'see {node_file_href} section `{section}\' in @cite{{book}}' => '',
673                        'see {reference_name}' => '',
674                        'see {ref}' => '',
675                        'see {title_ref}' => '',
676                        '{acronym_like} ({explanation})' => '',
677                        '{name} of {class}' => '',
678                        '{name} on {class}' => '',
679                        '{node_file_href}' => '',
680                        '{node_file_href} @cite{{book}}' => '',
681                        '{node_file_href} section `{section}\' in @cite{{book}}' => '',
682                        '{reference_name}' => '',
683                        '{ref}' => '',
684                        '{style} {number}' => '',
685                        '{style}: {caption_first_line}' => '',
686                        '{style}: {shortcaption_first_line}' => '',
687                        '{title_ref}' => '{title_ref}'
688                      };
689
690 $LANGUAGES->{'ca'} = {
691                        '  The buttons in the navigation panels have the following meaning:' => '  Els botons dels plafons de navegació tenen els significat següent:',
692                        '  where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => '  on l\'@strong{ Exemple } suposa que la posició actual està a @strong{ Subsubsecció U-Dos-tres } d\'un document a l\'estructura següent:',
693                        ' Up ' => ' Amunt ',
694                        '(outside of any element)' => '(fora de qualsevol element)',
695                        '(outside of any node)' => '(fora de qualsevol node)',
696                        '@b{{quotation_arg}:} ' => '@{{quotation_arg}:}',
697                        '@cite{{book}}' => '@cite{{book}}',
698                        '@{No value for `{value}\'@}' => '@{No hi ha cap valor per a `{value}\'@}',
699                        'About' => 'Quant a',
700                        'About (help)' => 'Quant a (ajuda)',
701                        'About This Document' => 'Quant a aquest document',
702                        'April' => 'Abril',
703                        'August' => 'Agost',
704                        'Back' => 'Endarrere',
705                        'Back section in previous file' => 'Endarrere una secció al fitxer previ',
706                        'Beginning of this chapter or previous chapter' => 'Inici d\'aquest capítol o capítol previ',
707                        'Button' => 'Botó',
708                        'Contents' => 'Continguts',
709                        'Cover (top) of document' => 'Portada (inici) del document',
710                        'Current' => 'Actual',
711                        'Current Position' => 'Posició actual',
712                        'Current section' => 'Secció actual',
713                        'December' => 'Desembre',
714                        'FastBack' => 'Endarrere ràpid',
715                        'FastForward' => 'Endavant ràpid',
716                        'February' => 'Febrer',
717                        'First' => 'Primera',
718                        'First section in reading order' => 'Primera secció a l\'orde de lectura',
719                        'Following' => 'Següent',
720                        'Following node' => 'Node següent',
721                        'Footnotes' => 'Notes a peu de pàgina',
722                        'Forward' => 'Endavant',
723                        'Forward section in next file' => 'Endavant una secció al fitxer següent',
724                        'From 1.2.3 go to' => 'De 1.2.3 ves a',
725                        'Go to' => 'Ves a',
726                        'Index' => 'Índex',
727                        'Index Entry' => 'Entrada d\'índex',
728                        'January' => 'Gener',
729                        'July' => 'Juliol',
730                        'Jump to' => 'Salta a',
731                        'June' => 'Juny',
732                        'Last' => 'Últim',
733                        'Last section in reading order' => 'Última secció en ordre de lectura',
734                        'March' => 'Març',
735                        'May' => 'Maig',
736                        'Menu:' => 'Menú',
737                        'Name' => 'Nom',
738                        'Next' => 'Següent',
739                        'Next chapter' => 'Capítol següent',
740                        'Next file' => 'Fitxer següent',
741                        'Next node' => 'Node següent',
742                        'Next section in reading order' => 'Secció següent en ordre de lectura',
743                        'Next section on same level' => 'Secció següent al mateix nivell',
744                        'NextFile' => 'Fitxer següent',
745                        'Node following in node reading order' => 'Node següent en ordre de lectura de nodes',
746                        'Node up' => 'Node amunt',
747                        'NodeNext' => 'Node següent',
748                        'NodePrev' => 'Node previ',
749                        'NodeUp' => 'Node Amunt',
750                        'November' => 'Novembre',
751                        'October' => 'Octobre',
752                        'Overview' => 'Panoràmica',
753                        'Prev' => 'Previ',
754                        'PrevFile' => 'Fitxer previ',
755                        'Previous' => 'Previ',
756                        'Previous file' => 'Fitxer previ',
757                        'Previous node' => 'Node previ',
758                        'Previous section in reading order' => 'Secció prèvia en ordre de lectura',
759                        'Previous section on same level' => 'Secció prèvia al mateix nivell',
760                        'Section' => 'Secció',
761                        'Section One' => 'Secció u',
762                        'See ' => 'Vegeu ',
763                        'See @cite{{book}}' => 'Vegeu @cite{{book}}',
764                        'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'Vegeu secció @asis{}`{section_name}\'@asis{}\' a @cite{{book}}',
765                        'See section `{section}\' in @cite{{book}}' => 'Vegeu la secció `{section}\' a @cite{{book}}',
766                        'See section {reference_name}' => 'Vegeu la secció {reference_name}',
767                        'See {node_file_href}' => 'Vegeu {node_file_href}',
768                        'See {node_file_href} @cite{{book}}' => 'Vegeu {node_file_href} @cite{{book}}',
769                        'See {node_file_href} section `{section}\' in @cite{{book}}' => 'Vegeu {node_file_href} secció `{secion}\' a @cite{{book}}',
770                        'See {reference_name}' => 'Vegeu {reference_name}',
771                        'See {ref}' => 'Vegeu {ref}',
772                        'See {title_ref}' => 'Vegeu {title_ref}',
773                        'September' => 'Septembre',
774                        'Short Table of Contents' => 'Taula de continguts breu',
775                        'Short table of contents' => 'Taula de continguts breu',
776                        'Subsection One-Four' => 'Subsecció U-Quatre',
777                        'Subsection One-One' => 'Subsecció U-U',
778                        'Subsection One-Three' => 'Subsecció U-Tres',
779                        'Subsection One-Two' => 'Subsecció U-Dos',
780                        'Subsubsection One-Two-Four' => 'Subsubsecció U-Dos-Quatre',
781                        'Subsubsection One-Two-One' => 'Subsubsecció U-Dos-U',
782                        'Subsubsection One-Two-Three' => 'Subsubsecció U-Dos-Tres',
783                        'Subsubsection One-Two-Two' => 'Subsubsecció U-Dos-Dos',
784                        'T2H_today' => 'T2H_today',
785                        'Table of Contents' => 'Taula de contingus',
786                        'Table of contents' => 'Taula de continguts',
787                        'The node you are looking for is at {href}.' => 'El node que esteu buscant està a {href}.',
788                        'This' => 'Aquest',
789                        'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => 'Aquest document es va generar a @i{{date}} usant @uref{{program_homepage}, @i{{program}}}',
790                        'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => 'Aquest document es va generar usant @uref{{program_homepage}, @empf{{program}}}.',
791                        'Top' => 'Part superior',
792                        'Untitled Document' => 'Document sense títol',
793                        'Up' => 'Amunt',
794                        'Up node' => 'Amunt node',
795                        'Up section' => 'Amunt secció',
796                        'current' => 'actual',
797                        'on @emph{{date}}' => 'el @empf{{date}}',
798                        'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'secció `@asis{}`{secion_name}\'@asis{}\' a @cite{{book}}',
799                        'section `{section}\' in @cite{{book}}' => 'secció `{section}\' a @cite{{book}}',
800                        'see ' => 'vegeu ',
801                        'see @cite{{book}}' => 'vegeu @cite{{book}}',
802                        'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'vegeu secció `@asis{}`{secion_name}\'@asis{}\' a @cite{{book}}',
803                        'see section `{section}\' in @cite{{book}}' => 'vegeu secció `{section}\' a @cite{{book}}',
804                        'see section {reference_name}' => 'vegeu secció {reference_name}',
805                        'see {node_file_href}' => 'vegeu {node_file_href}',
806                        'see {node_file_href} @cite{{book}}' => 'vegeu {node_file_href} @cite{{book}}',
807                        'see {node_file_href} section `{section}\' in @cite{{book}}' => 'vegeu {node_file_href} secció `{seciont}\' a @cite{{book}}',
808                        'see {reference_name}' => 'vegeu {reference_name}',
809                        'see {ref}' => 'vegeu {ref}',
810                        'see {title_ref}' => 'vegeu {title_ref}',
811                        '{acronym_like} ({explanation})' => '{acronym_lie} ({explanation})',
812                        '{name} of {class}' => '{name} de {class}',
813                        '{name} on {class}' => '{name} a {class}',
814                        '{node_file_href}' => '{node_file_href}',
815                        '{node_file_href} @cite{{book}}' => '{node_file_href} @cite{{book}}',
816                        '{node_file_href} section `{section}\' in @cite{{book}}' => '{node_file_href} secció `{secció}\' a @cite{{book}}',
817                        '{reference_name}' => '{reference_name}',
818                        '{ref}' => '{ref}',
819                        '{style} {number}' => '{style} {number}',
820                        '{style}: {caption_first_line}' => '{style}: {caption_first_line}',
821                        '{style}: {shortcaption_first_line}' => '{style}: {shortcaption_first_line}',
822                        '{title_ref}' => '{title_ref}'
823                      };
824
825 $LANGUAGES->{'zh'} = {
826                        '  The buttons in the navigation panels have the following meaning:' => '  在导航面板上按钮有以下含意:',
827                        '  where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => ' 这里的@strong{ 例子 } 假设当前的位置是在紧接着的结构的文档中的 @strong{ 小分段 1-2-3 }:',
828                        ' Up ' => ' 上 ',
829                        '(outside of any element)' => '(任何元素外面)',
830                        '(outside of any node)' => '(任何节点外面)',
831                        '@b{{quotation_arg}:} ' => '@b{{quotation_arg}:} ',
832                        '@cite{{book}}' => '@cite{{book}}',
833                        '@{No value for `{value}\'@}' => '@{没有值 `{value}\'@}',
834                        'About' => '关于',
835                        'About (help)' => '关于 (帮助)',
836                        'About This Document' => '关于本文档',
837                        'April' => '4 月',
838                        'August' => '8 月',
839                        'Back' => '返回',
840                        'Back section in previous file' => '返回到前一个文件',
841                        'Beginning of this chapter or previous chapter' => '本章开头或前一章',
842                        'Button' => '按钮',
843                        'Contents' => '目录',
844                        'Cover (top) of document' => '文档的封面(首页)',
845                        'Current' => '当前',
846                        'Current Position' => '当前的位置',
847                        'Current section' => '当前的段',
848                        'December' => '12 月',
849                        'FastBack' => '快速返回',
850                        'FastForward' => '快速向前',
851                        'February' => '2 月',
852                        'First' => '第一个',
853                        'First section in reading order' => '看的第一段',
854                        'Following' => '紧接着的',
855                        'Following node' => '紧接着的节点',
856                        'Footnotes' => '脚注',
857                        'Forward' => '向前',
858                        'Forward section in next file' => '向前到下一个文件的段',
859                        'From 1.2.3 go to' => '从1.2.3 到',
860                        'Go to' => '到',
861                        'Index' => '索引',
862                        'Index Entry' => '索引条目',
863                        'January' => '1 月',
864                        'July' => '7 月',
865                        'Jump to' => '跳转到',
866                        'June' => '6 月',
867                        'Last' => '最后',
868                        'Last section in reading order' => '看的最后一段',
869                        'March' => '3 月',
870                        'May' => '5 月',
871                        'Menu:' => '菜单',
872                        'Name' => '名字',
873                        'Next' => '下一个',
874                        'Next chapter' => '下一章',
875                        'Next file' => '下一个文件',
876                        'Next node' => '下一个节点',
877                        'Next section in reading order' => '看的下一段',
878                        'Next section on same level' => '同级的下一段',
879                        'NextFile' => '下一个文件',
880                        'Node following in node reading order' => '看的下一个节点',
881                        'Node up' => '向上一个节点',
882                        'NodeNext' => '下一个节点',
883                        'NodePrev' => '前一个节点',
884                        'NodeUp' => '向上一个节点',
885                        'November' => '11 月',
886                        'October' => '10 月',
887                        'Overview' => '综述',
888                        'Prev' => '前一个',
889                        'PrevFile' => '前一个文件',
890                        'Previous' => '前一个',
891                        'Previous file' => '前一个文件',
892                        'Previous node' => '前一个节点',
893                        'Previous section in reading order' => '看的前一段',
894                        'Previous section on same level' => '同级的前一段',
895                        'Section' => '段',
896                        'Section One' => '段 1',
897                        'See ' => '见',
898                        'See @cite{{book}}' => '见 @cite{{book}}',
899                        'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
900                        'See section `{section}\' in @cite{{book}}' => '',
901                        'See section {reference_name}' => '见段 {reference_name}',
902                        'See {node_file_href}' => '见 {node_file_href}',
903                        'See {node_file_href} @cite{{book}}' => '见 {node_file_href} @cite{{book}}',
904                        'See {node_file_href} section `{section}\' in @cite{{book}}' => '见在@cite{{book}} 中的 {node_file_href} 段 `{section}\' ',
905                        'See {reference_name}' => '见 {reference_name}',
906                        'See {ref}' => '见 {ref}',
907                        'See {title_ref}' => '见 {title_ref}',
908                        'September' => '9 月',
909                        'Short Table of Contents' => '短目录',
910                        'Short table of contents' => '短目录',
911                        'Subsection One-Four' => '分段 1-4',
912                        'Subsection One-One' => '分段 1-1',
913                        'Subsection One-Three' => '分段 1-3',
914                        'Subsection One-Two' => '分段 1-2',
915                        'Subsubsection One-Two-Four' => '小分段 1-2-4',
916                        'Subsubsection One-Two-One' => '小分段 1-2-1',
917                        'Subsubsection One-Two-Three' => '小分段 1-2-3',
918                        'Subsubsection One-Two-Two' => '小分段 1-2-2',
919                        'T2H_today' => '',
920                        'Table of Contents' => '目录',
921                        'Table of contents' => '目录',
922                        'The node you are looking for is at {href}.' => '你查找的节点在{href}。',
923                        'This' => '这个',
924                        'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => '本文档在 @i{{date}} 上用 @uref{{program_homepage}, @i{{program}}} 生成的。',
925                        'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => '本文档用 @uref{{program_homepage}, @emph{{program}}} 生成的。',
926                        'Top' => '首页',
927                        'Untitled Document' => '没有标题的文档',
928                        'Up' => '上',
929                        'Up node' => '上一节点',
930                        'Up section' => '上一段',
931                        'current' => '目前',
932                        'on @emph{{date}}' => '@emph{{date}} 上',
933                        'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '',
934                        'section `{section}\' in @cite{{book}}' => '',
935                        'see ' => '见',
936                        'see @cite{{book}}' => '见 @cite{{book}}',
937                        'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => '见在@cite{{book}}里的段`@asis{}`{section_name}\'@asis{}\'',
938                        'see section `{section}\' in @cite{{book}}' => '见在@cite{{book}}里的段`{section}\'',
939                        'see section {reference_name}' => '见段 {reference_name}',
940                        'see {node_file_href}' => '见 {node_file_href}',
941                        'see {node_file_href} @cite{{book}}' => '见 {node_file_href} @cite{{book}}',
942                        'see {node_file_href} section `{section}\' in @cite{{book}}' => '见在@cite{{book}}里的{node_file_href} 段`{section}\'',
943                        'see {reference_name}' => '见 {reference_name}',
944                        'see {ref}' => '见 {ref}',
945                        'see {title_ref}' => '见 {title_ref}',
946                        '{acronym_like} ({explanation})' => '{acronym_like} ({explanation})',
947                        '{name} of {class}' => '{class} 的 {name}',
948                        '{name} on {class}' => '在{class} 上的 {name}',
949                        '{node_file_href}' => '',
950                        '{node_file_href} @cite{{book}}' => '',
951                        '{node_file_href} section `{section}\' in @cite{{book}}' => '{node_file_href} 段 `{section}\' 在 @cite{{book}}里',
952                        '{reference_name}' => '',
953                        '{ref}' => '{ref}',
954                        '{style} {number}' => '{style} {number}',
955                        '{style}: {caption_first_line}' => '{style}: {caption_first_line}',
956                        '{style}: {shortcaption_first_line}' => '{style}: {shortcaption_first_line}',
957                        '{title_ref}' => '{title_ref}'
958                      };
959
960
961 sub ly_get_string () {
962     my $lang = $Texi2HTML::THISDOC{current_lang};
963     my $string = shift;
964     if ($lang and $lang ne "en" and $LY_LANGUAGES->{$lang}->{$string}) {
965         return $LY_LANGUAGES->{$lang}->{$string};
966     } else {
967         return $string;
968     }
969 }
970
971
972 #############################################################################
973 ### FUNCTIONALITY FOR MAIN WEB PAGES
974 #############################################################################
975
976 our $web_manual;
977
978 #############################################################################
979 ###  SETTINGS FOR TEXI2HTML
980 #############################################################################
981
982 # Validation fix for texi2html<=1.82
983 $Texi2HTML::Config::DOCTYPE = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
984
985 @Texi2HTML::Config::CSS_REFS = (
986     {FILENAME => "lilypond-manuals.css", TITLE => "Default style"}
987     );
988 @Texi2HTML::Config::ALT_CSS_REFS      = (
989     );
990
991 sub web_settings() {
992   print STDERR "Processing web site: [$Texi2HTML::THISDOC{current_lang}]\n";
993   $Texi2HTML::Config::BODYTEXT = "";
994   @Texi2HTML::Config::CSS_REFS      = (
995       {FILENAME => "lilypond-website.css", TITLE => "Default style"}
996       );
997   @Texi2HTML::Config::ALT_CSS_REFS      = (
998       );
999 }
1000
1001 $Texi2HTML::Config::USE_ACCESSKEY = 1;
1002 $Texi2HTML::Config::USE_LINKS     = 1;
1003 $Texi2HTML::Config::USE_REL_REV   = 1;
1004 $Texi2HTML::Config::SPLIT_INDEX   = 0;
1005 $Texi2HTML::Config::SEPARATED_FOOTNOTES = 0; # Print footnotes on same page, not separated
1006
1007 my $bigpage = 0;
1008 my $have_index_entries = 0;
1009 if ($Texi2HTML::Config::SPLIT eq 'section' or
1010     $Texi2HTML::Config::SPLIT eq 'node') {
1011   $Texi2HTML::Config::element_file_name    = \&lilypond_element_file_name;
1012   $bigpage = 0;
1013 } else {
1014   $bigpage = 1;
1015 }
1016
1017 $Texi2HTML::Config::anchor  = \&lilypond_anchor;
1018 $Texi2HTML::Config::element_target_name  = \&lilypond_element_target_name;
1019 $default_print_element_header = $Texi2HTML::Config::print_element_header;
1020 $Texi2HTML::Config::print_element_header = \&lilypond_print_element_header;
1021 $Texi2HTML::Config::print_page_foot      = \&print_lilypond_page_foot;
1022 $Texi2HTML::Config::print_navigation     = \&lilypond_print_navigation;
1023 $Texi2HTML::Config::external_ref         = \&lilypond_external_ref;
1024 $default_external_href = $Texi2HTML::Config::external_href;
1025 $Texi2HTML::Config::external_href        = \&lilypond_external_href;
1026 $default_toc_body = $Texi2HTML::Config::toc_body;
1027 $Texi2HTML::Config::toc_body             = \&lilypond_toc_body;
1028 $Texi2HTML::Config::css_lines            = \&lilypond_css_lines;
1029 $default_unknown = $Texi2HTML::Config::unknown;
1030 $Texi2HTML::Config::unknown              = \&lilypond_unknown;
1031 $default_print_page_head = $Texi2HTML::Config::print_page_head;
1032 $Texi2HTML::Config::print_page_head      = \&lilypond_print_page_head;
1033 # $Texi2HTML::Config::foot_line_and_ref    = \&lilypond_foot_line_and_ref;
1034 $Texi2HTML::Config::foot_line_and_ref  = \&makeinfo_like_foot_line_and_ref;
1035 $Texi2HTML::Config::foot_lines         = \&makeinfo_like_foot_lines;
1036 $Texi2HTML::Config::paragraph          = \&makeinfo_like_paragraph;
1037
1038
1039
1040 # Examples should be formatted similar to quotes:
1041 $Texi2HTML::Config::complex_format_map->{'example'} = {
1042   'begin' => q{"<blockquote>"},
1043   'end' => q{"</blockquote>\n"},
1044   'style' => 'code',
1045  };
1046
1047 %Texi2HTML::config::misc_pages_targets = (
1048    'Overview' => 'Overview',
1049    'Contents' => 'Contents',
1050    'About' => 'About'
1051 );
1052
1053
1054 my @section_to_filename;
1055
1056
1057
1058
1059 #############################################################################
1060 ###  DEBUGGING
1061 #############################################################################
1062
1063 use Data::Dumper;
1064 $Data::Dumper::Maxdepth = 2;
1065
1066 sub print_element_info($)
1067 {
1068   my $element = shift;
1069   print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
1070   print "Element: $element\n";
1071   print Dumper($element);
1072 }
1073
1074
1075
1076
1077
1078 #############################################################################
1079 ###  HELPER FUNCTIONS
1080 #############################################################################
1081
1082 # only lc() the last portion of an href
1083 sub lc_last($)
1084 {
1085   my $href = shift;
1086   my @hrefsplit = split('/', $href);
1087   # change the last portion (the filename), if it exists;
1088   # if it is a plain filename with no path, change the string as a whole
1089   if ($#hrefsplit > 0) {
1090     @hrefsplit[$#hrefsplit] = lc( @hrefsplit[$#hrefsplit] );
1091     $href = join("/", @hrefsplit);
1092   } else {
1093     $href = lc($href);
1094   }
1095   return $href;
1096 }
1097
1098 # Convert a given node name to its proper file name (normalization as explained
1099 # in the texinfo manual:
1100 # http://www.gnu.org/software/texinfo/manual/texinfo/html_node/HTML-Xref-Node-Name-Expansion.html
1101 sub texinfo_file_name($)
1102 {
1103   my $text = shift;
1104   my $result = '';
1105   # File name normalization by texinfo:
1106   # 1/2: letters and numbers are left unchanged
1107   # 3/4: multiple, leading and trailing whitespace is removed
1108   $text = main::normalise_space($text);
1109   # 5/6: all remaining spaces are converted to '-', all other 7- or 8-bit
1110   #      chars are replaced by _xxxx (xxxx=ascii character code)
1111   while ($text ne '') {
1112     if ($text =~ s/^([A-Za-z0-9]+)//o) { # number or letter stay unchanged
1113       $result .= $1;
1114     } elsif ($text =~ s/^ //o) { # space -> '-'
1115       $result .= '-';
1116     } elsif ($text =~ s/^(.)//o) { # Otherwise use _xxxx (ascii char code)
1117       my $ccode = ord($1);
1118       if ( $ccode <= 0xFFFF ) {
1119         $result .= sprintf("_%04x", $ccode);
1120       } else {
1121         $result .= sprintf("__%06x", $ccode);
1122       }
1123     }
1124   }
1125   # 7: if name does not begin with a letter, prepend 't_g' (so it starts with a letter)
1126   if ($result !~ /^[a-zA-Z]/) {
1127     $result = 't_g' . $result;
1128   }
1129   # DONE
1130   return lc_last($result)
1131 }
1132
1133 # Load a file containing a nodename<=>filename map (tab-sepatared, i.e.
1134 # NODENAME\tFILENAME\tANCHOR
1135 # Returns a ref to a hash "Node title" => ["FilenameWithoutExt", "Anchor"]
1136 sub load_map_file ($)
1137 {
1138   my $mapfile = shift;
1139   my $node_map = ();
1140
1141   # For some unknown reason, Perl on my system (5.10.0 on Fedora 12)
1142   # refuses to open map files of translated documents with
1143   # '<:encoding(utf8)', but decoding from UTF-8 line by line works. -jm
1144   if (open(XREFFILE,'<', $mapfile)) {
1145     my $line;
1146     # print STDERR "*** PRINTING MAP FILE LINES ***\n";
1147     while ( $line = decode ('UTF-8', <XREFFILE>) ) {
1148       # parse the tab-separated entries and insert them into the map:
1149       chomp($line);
1150       my @entries = split(/\t/, $line);
1151       if (scalar (@entries) == 3) {
1152         $node_map->{$entries[0]} = [$entries[1], $entries[2]];
1153         $, = " ";
1154         # print STDERR @entries;
1155         # print STDERR "\n";
1156       } else {
1157         print STDERR "Invalid entry in the node file $mapfile: $line\n";
1158       }
1159     }
1160     close (XREFFILE);
1161   } else {
1162     print STDERR "WARNING: Unable to load the map file $mapfile\n";
1163   }
1164   return $node_map;
1165 }
1166
1167
1168 # Split the given path into dir and basename (with .texi removed). Used mainly
1169 # to get the path/basename of the original texi input file
1170 sub split_texi_filename ($)
1171 {
1172   my $docu = shift;
1173   my ($docu_dir, $docu_name);
1174   if ($docu =~ /(.*\/)/) {
1175     chop($docu_dir = $1);
1176     $docu_name = $docu;
1177     $docu_name =~ s/.*\///;
1178   } else {
1179      $docu_dir = '.';
1180      $docu_name = $docu;
1181   }
1182   $docu_name =~ s/\.te?x(i|info)?$//;
1183   return ($docu_dir, $docu_name);
1184 }
1185
1186
1187
1188
1189
1190 #############################################################################
1191 ###  CSS HANDLING
1192 #############################################################################
1193
1194 # Include our standard CSS file, not hard-coded CSS code directly in the HTML!
1195 # For IE, conditionally include the lilypond-ie-fixes.css style sheet
1196 sub lilypond_css_lines ($$)
1197 {
1198   my $import_lines = shift;
1199   my $rule_lines = shift;
1200   return if (defined($Texi2HTML::THISDOC{'CSS_LINES'}));
1201   if (@$rule_lines or @$import_lines)
1202   {
1203     $Texi2HTML::THISDOC{'CSS_LINES'} = "<style type=\"text/css\">\n<!--\n";
1204     $Texi2HTML::THISDOC{'CSS_LINES'} .= join('',@$import_lines) . "\n" if (@$import_lines);
1205     $Texi2HTML::THISDOC{'CSS_LINES'} .= join('',@$rule_lines) . "\n" if (@$rule_lines);
1206     $Texi2HTML::THISDOC{'CSS_LINES'} .= "-->\n</style>\n";
1207   }
1208   foreach my $ref (@CSS_REFS)
1209   {
1210     $Texi2HTML::THISDOC{'CSS_LINES'} .=
1211         "<link rel=\"stylesheet\" type=\"text/css\" title=\"$ref->{TITLE}\" href=\"css/$ref->{FILENAME}\">\n";
1212   }
1213   foreach my $ref (@Texi2HTML::Config::ALT_CSS_REFS)
1214   {
1215     $Texi2HTML::THISDOC{'CSS_LINES'} .=
1216         "<link rel=\"alternate stylesheet\" type=\"text/css\" href=\"css/$ref->{FILENAME}\" title=\"$ref->{TITLE}\">\n";
1217   }
1218
1219   # The ie-fixes stylesheet is needed for the docs, but not the website.
1220   if (not ($web_manual)) {
1221     $Texi2HTML::THISDOC{'CSS_LINES'} .=
1222         "<!--[if lte IE 7]>\n<link href=\"css/lilypond-ie-fixes.css\" rel=\"stylesheet\" type=\"text/css\">\n<![endif]-->\n";
1223   }
1224
1225   if ($ENV{'AJAX_SEARCH'} == 1) {
1226     # Add the JavaScript file only if we have an index.
1227     # Unfortunately, init_out is called after css_lines, so as a workaround
1228     # here we have to check again for the existence of an index...
1229     my $ix = main::get_index ("cp");
1230     $have_index_entries = (scalar $ix > 0);
1231     my $reldir = "";
1232     $reldir = "../" unless $bigpage;
1233     if ($have_index_entries) {
1234       $Texi2HTML::THISDOC{'CSS_LINES'} .= "<script language=\"JavaScript\" src=\"${reldir}lily_search.js\"></script>\n";
1235     }
1236   }
1237 }
1238
1239
1240
1241
1242
1243 #############################################################################
1244 ###  SPLITTING BASED ON NUMBERED SECTIONS
1245 #############################################################################
1246
1247 my $lastfilename;
1248 my $docnr = 0;
1249 my $node_to_filename_map = ();
1250 $source_to_translationof_map = ();
1251
1252
1253 # This function makes sure that files are only generated for numbered sections,
1254 # but not for unnumbered ones. It is called after texi2html has done its own
1255 # splitting and simply returns the filename for the node given as first argument
1256 # Nodes with the same filename will be printed out to the same filename, so
1257 # this really all we need. Also, make sure that the file names for sections
1258 # are derived from the section title. We also might want to name the anchors
1259 # according to node titles, which works by simply overriding the id element of
1260 # the $element hash.
1261 # If an external nodename<=>filename/anchor map file is found (loaded in
1262 # the command handler, use the externally created values, otherwise use the
1263 # same logic here.
1264 sub lilypond_element_file_name($$$)
1265 {
1266   my $element = shift;
1267   my $type = shift;
1268   my $docu_name = shift;
1269   my $docu_ext = $Texi2HTML::Config::EXTENSION;
1270
1271   my $node_name = main::remove_texi($element->{'node_ref'}->{'texi'});
1272   # the snippets page does not use nodes for the snippets, so in this case
1273   # we'll have to use the section name!
1274   if ($node_name eq '') {
1275     $node_name = main::remove_texi($element->{'texi'});
1276   }
1277
1278   # If we have an entry in the section<=>filename map, use that one, otherwise
1279   # generate the filename/anchor here. In the latter case, external manuals
1280   # will not be able to retrieve the file name for xrefs!!! Still, I already
1281   # had that code, so I'll leave it in in case something goes wrong with the
1282   # extract_texi_filenames.py script in the lilypond build process!
1283   if (exists ($node_to_filename_map->{$node_name})) {
1284     (my $filename, my $anchor) = @{$node_to_filename_map->{$node_name}};
1285     $filename .= ".$docu_ext" if (defined($docu_ext));
1286     # don't do lc_last here, otherwise the colors are messed up!
1287     $filename = lc($filename);
1288
1289     # unnumbered sections (except those at top-level!) always go to the same
1290     # file as the previous numbered section
1291     if (not ($web_manual) and not ($element->{number})
1292         and not ($lastfilename eq '') and ($element->{level} > 1)) {
1293       $filename = $lastfilename;
1294     }
1295     if (($filename eq $lastfilename)) {
1296       $$element{doc_nr} = $docnr;
1297     } else {
1298       $docnr += 1;
1299       $$element{doc_nr} = $docnr;
1300       $lastfilename = $filename;
1301     }
1302     #print STDERR "Output file name: $filename\n";
1303     $filename = lc_last($filename);
1304     return $filename;
1305
1306   } elsif ($type eq "top" or $type eq "toc" or $type eq "doc" or
1307            $type eq "stoc" or $type eq "foot" or $type eq "about") {
1308     return;
1309   } else {
1310     print STDERR "WARNING: Node '$node_name' was NOT found in the map\n"
1311         unless ($node_name eq '') or ($element->{'tag'} eq 'unnumberedsec')
1312                or ($node_name =~ /NOT REALLY USED/);
1313
1314     # Numbered sections will get a filename Node_title, unnumbered sections will use
1315     # the file name of the previous numbered section:
1316     if (($element->{number}) or ($lastfilename eq '') or ($element->{level} == 1)) {
1317       # normalize to the same file name as texinfo
1318       if ($element->{translationof}) {
1319         $node_name = main::remove_texi($element->{translationof});
1320       }
1321       my $filename = texinfo_file_name($node_name);
1322       $filename .= ".$docu_ext" if (defined($docu_ext));
1323       $filename = lc_last($filename);
1324       $docnr += 1;
1325       $$element{doc_nr} = $docnr;
1326       $lastfilename = $filename;
1327       print STDERR "File name: $filename\n";
1328       return $filename;
1329     } else {
1330       $$element{doc_nr} = $docnr;
1331       $filename = lc_last($filename);
1332       print STDERR "File name: $filename\n";
1333       return $filename;
1334     }
1335   }
1336
1337   return;
1338 }
1339
1340 sub lilypond_normalise_node($)
1341 {
1342     my $text = shift;
1343     my $norm = main::t2h_default_normalise_node($text);
1344     if (exists ($source_to_translationof_map->{$text})) {
1345         my $original = $source_to_translationof_map->{$text};
1346         $norm = main::t2h_default_normalise_node($original);
1347     }
1348
1349     return $norm;
1350 }
1351
1352 # This function produces an anchor.
1353 #
1354 # arguments:
1355 # $name           :   anchor name
1356 # $href           :   anchor href
1357 # text            :   text displayed
1358 # extra_attribs   :   added to anchor attributes list
1359 sub lilypond_anchor($;$$$)
1360 {
1361     my $name = shift;
1362     my $href = shift;
1363     my $text = shift;
1364     my $attributes = shift;
1365     $href = remove_unneeded_anchor($href);
1366     if (!defined($attributes) or ($attributes !~ /\S/))
1367     {
1368         $attributes = '';
1369     }
1370     else
1371     {
1372         $attributes = ' ' . $attributes;
1373     }
1374     $name = '' if (!defined($name) or ($name !~ /\S/));
1375     $href = '' if (!defined($href) or ($href !~ /\S/));
1376     $text = '' if (!defined($text));
1377     return $text if (($name eq '') and ($href eq ''));
1378     $name = "name=\"$name\"" if ($name ne '');
1379     $href = "href=\"$href\"" if ($href ne '');
1380     $href = ' ' . $href if (($name ne '') and ($href ne ''));
1381     return "<a ${name}${href}${attributes}>$text</a>";
1382 }
1383
1384
1385 sub lilypond_element_target_name($$$)
1386 {
1387   my $element = shift;
1388   my $target = shift;
1389   my $id = shift;
1390   # Target is based on node name (or sec name for secs without node attached)
1391   my $node_name = main::remove_texi($element->{'node_ref'}->{'texi'});
1392   if ($node_name eq '') {
1393     $node_name = main::remove_texi($element->{'texi'});
1394   }
1395
1396   # If we have an entry in the section<=>filename map, use that one, otherwise
1397   # generate the anchor here.
1398   if (exists ($node_to_filename_map->{$node_name})) {
1399     (my $filename, $target) = @{$node_to_filename_map->{$node_name}};
1400   } else {
1401     my $anchor = $node_name;
1402     if ($element->{translationof}) {
1403       $anchor = main::remove_texi($element->{translationof});
1404     }
1405     # normalize to the same file name as texinfo
1406     $target = texinfo_file_name($anchor);
1407   }
1408   # TODO: Once texi2html correctly prints out the target and not the id for
1409   #       the sections, change this back to ($id, $target)
1410   # I don't understand this comment, so I'm reluctant to delete it -gp
1411   $target = lc_last($target);
1412   $id = lc($target);
1413 # $id =~ s/-1$//i; # remove any trailing "-1"
1414   return ($target, $id);
1415 }
1416
1417
1418 ## Load the map file for the corrently processed texi file. We do this
1419 #  using a command init handler, since texi2html does not have any
1420 #  other hooks that are called after THISDOC is filled but before phase 2
1421 #  of the texi2html conversion.
1422 sub lilypond_init_map ()
1423 {
1424     my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'});
1425     my $map_filename = main::locate_include_file ("${docu_name}.$Texi2HTML::THISDOC{current_lang}.xref-map")
1426         || main::locate_include_file ("${docu_name}.xref-map");
1427     #print STDERR "Map filename is: $map_filename\nDocu name is $docu_name\n";
1428     if ($docu_name eq 'web') {
1429         $web_manual = 1;
1430         web_settings();
1431     }
1432     $node_to_filename_map = load_map_file ($map_filename);
1433 }
1434 push @Texi2HTML::Config::command_handler_init, \&lilypond_init_map;
1435
1436
1437
1438 #############################################################################
1439 ###  CLEANER LINK TITLE FOR EXTERNAL REFS
1440 #############################################################################
1441
1442 # The default formatting of external refs returns e.g.
1443 # "(lilypond-internals)Timing_translator", so we remove all (...) from the
1444 # file_and_node argument. Also, we want only a very simple format, so we don't
1445 # even call the default handler!
1446 sub lilypond_external_ref($$$$$$)
1447 {
1448   my $type = shift;
1449   my $section = shift;
1450   my $book = shift;
1451   my $file_node = shift;
1452   my $href = shift;
1453
1454   $href = lc_last($href);
1455
1456   my $cross_ref = shift;
1457
1458   my $displaytext = '';
1459
1460   # 1) if we have a cross ref name, that's the text to be displayed:
1461   # 2) For the top node, use the (printable) name of the manual, unless we
1462   #    have an explicit cross ref name
1463   # 3) In all other cases use the section name
1464   if ($cross_ref ne '') {
1465     $displaytext = $cross_ref;
1466   } elsif (($section eq '') or ($section eq 'Top')) {
1467     $displaytext = $book;
1468   } else {
1469     $displaytext = $section;
1470   }
1471
1472   $displaytext = &$anchor('', $href, $displaytext) if ($displaytext ne '');
1473   return &$I('%{node_file_href}', { 'node_file_href' => $displaytext });
1474 }
1475
1476
1477
1478
1479
1480 #############################################################################
1481 ###  HANDLING TRANSLATED SECTIONS: handle @translationof, secname<->filename
1482 ###                  map stored on disk, xrefs in other manuals load that map
1483 #############################################################################
1484
1485
1486 # Try to make use of @translationof to generate files according to the original
1487 # English section title...
1488 sub lilypond_unknown($$$$$)
1489 {
1490     my $macro = shift;
1491     my $line = shift;
1492     my $pass = shift;
1493     my $stack = shift;
1494     my $state = shift;
1495
1496     # the @translationof macro provides the original English section title,
1497     # which should be used for file/anchor naming, while the title will be
1498     # translated to each language
1499     # It is already used by extract_texi_filenames.py, so this should not be
1500     # necessary here at all. Still, I'll leave the code in just in case the
1501     # python script messed up ;-)
1502     if ($pass == 1 and $macro eq "translationof") {
1503       if (ref($state->{'element'}) eq 'HASH') {
1504           $state->{'element'}->{'translationof'} = main::normalise_space($line);
1505           my $source = main::normalise_space ($line);
1506           if (ref($state->{'node_ref'}) eq 'HASH') {
1507               my $translationof = $state->{'node_ref'}->{'texi'};
1508               our %source_to_translationof_map;
1509               $source_to_translationof_map->{$source} = $translationof;
1510           }
1511       }
1512       return ('', 1, undef, undef);
1513     } else {
1514       return &$default_unknown($macro, $line, $pass, $stack, $state);
1515     }
1516 }
1517
1518
1519 my %translated_books = ();
1520 # Construct a href to an external source of information.
1521 # node is the node with texinfo @-commands
1522 # node_id is the node transliterated and transformed as explained in the
1523 #         texinfo manual
1524 # node_xhtml_id is the node transformed such that it is unique and can
1525 #     be used to make an html cross ref as explained in the texinfo manual
1526 # file is the file in '(file)node'
1527 sub lilypond_external_href($$$)
1528 {
1529   my $node = shift;
1530   my $node_id = shift;
1531   my $node_xhtml_id = shift;
1532   my $file = shift;
1533
1534   # 1) Keep a hash of book->section_map
1535   # 2) if not file in keys hash => try to load the map (assign empty map if
1536   #    non-existent => will load only once!)
1537   # 3) if node in the section=>(file, anchor) map, replace node_id and
1538   #    node_xhtml_id by the map's values
1539   # 4) call the default_external_href with these values (or the old ones if not found)
1540
1541   if (($node_id ne '') and defined($file) and ($node_id ne 'Top')) {
1542     my $map_name = $file;
1543     $map_name =~ s/-big-page//;
1544
1545     # Load the map if we haven't done so already
1546     if (!exists($translated_books{$map_name})) {
1547       my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'});
1548       my $map_filename = main::locate_include_file ("${map_name}.$Texi2HTML::THISDOC{current_lang}.xref-map")
1549           || main::locate_include_file ("${map_name}.xref-map");
1550       $translated_books{$map_name} = load_map_file ($map_filename);
1551     }
1552
1553     # look up translation. use these values instead of the old filename/anchor
1554     my $section_name_map = $translated_books{$map_name};
1555     my $node_text = main::remove_texi($node);
1556     if (defined($section_name_map->{$node_text})) {
1557       ($node_id, $node_xhtml_id) = @{$section_name_map->{$node_text}};
1558     } else {
1559       print STDERR "WARNING: Unable to find node '$node_text' in book $map_name.\n";
1560     }
1561   }
1562
1563   if (defined $file) {
1564     $href = &$default_external_href($node, $node_id, $node_xhtml_id, lc_last($file));
1565     $href = remove_unneeded_anchor($href);
1566
1567     if ($web_manual) {
1568       my $only_web_version = $ENV{ONLY_WEB_VERSION};
1569       if ($only_web_version) {
1570         $href = "../../doc/".$only_web_version."/Documentation/web/".$href;
1571       }
1572     }
1573
1574     return $href;
1575   } else {
1576     $href = &$default_external_href($node, $node_id, $node_xhtml_id);
1577     $href = remove_unneeded_anchor($href);
1578     return $href;
1579   }
1580 }
1581
1582 sub remove_unneeded_anchor($)
1583 {
1584   my $href = shift;
1585   my @hrefsplit = split("/", $href);
1586   for ($i = 0; $i < @hrefsplit; $i++) {
1587     $item = @hrefsplit[$i];
1588     if ($item =~ /#/) {
1589       @split = split(".html#", $item);
1590       if (@split[0] eq @split[1]) {
1591         @hrefsplit[$i] = @split[0] . ".html";
1592       }
1593     }
1594   }
1595   $href = join("/", @hrefsplit);
1596   return $href
1597 }
1598
1599
1600
1601 #############################################################################
1602 ###  CUSTOM TOC FOR EACH PAGE (in a frame on the left)
1603 #############################################################################
1604
1605 my $page_toc_depth = 2;
1606 my @default_toc = [];
1607
1608 # Initialize the toc_depth to 1 if the command-line option -D=short_toc is given
1609 sub lilypond_init_toc_depth ()
1610 {
1611   if (exists($main::value{'short_toc'}) and not exists($main::value{'bigpage'})
1612       and not $web_manual) {
1613     $page_toc_depth = 1;
1614   }
1615 }
1616 # Set the TOC-depth (depending on a texinfo variable short_toc) in a
1617 # command-handler, so we have them available when creating the pages
1618 push @Texi2HTML::Config::command_handler_process, \&lilypond_init_toc_depth;
1619
1620
1621
1622 # recursively generate the TOC entries for the element and its children (which
1623 # are only shown up to maxlevel. All ancestors of the current element are also
1624 # shown with their immediate children, irrespective of their level.
1625 # Unnumbered entries are only printed out if they are at top-level or 2nd level
1626 # or their parent element is an ancestor of the currently viewed node.
1627 # The conditions to call this method to print the entry for a child node is:
1628 # -) the parent is an ancestor of the current page node
1629 # -) the parent is a numbered element at top-level toplevel (i.e. show numbered
1630 #    and unnumbered 2nd-level children of numbered nodes)
1631 # -) the child element is a numbered node below level maxlevel
1632 sub generate_ly_toc_entries($$$$$)
1633 {
1634   my $element = shift;
1635   my $element_path = shift;
1636   my $maxlevel = shift;
1637   if ($web_manual) {
1638     $maxlevel = 1;
1639   }
1640   my $child_count = shift;
1641   my $current_element = shift;
1642   # Skip undefined sections, plus all sections generated by index splitting
1643   return() if (not defined($element) or exists($element->{'index_page'}));
1644   my @result = ();
1645   my $level = $element->{'toc_level'};
1646   my $is_parent_of_current = $element->{'id'} && $element_path->{$element->{'id'}};
1647   my $ind = '  ' x $level;
1648   my $this_css_class = " class=\"";
1649   # color indices for the second navigation bar on the website
1650   if ($web_manual) {
1651       my %color_maps = (
1652           'introduction' => [2, 2, 2, 2, 3, 3, 4, 4],
1653           'download' => [2, 2, 2, 3, 3, 4],
1654           'manuals' => [1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4],
1655           'community' => [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4],
1656           );
1657       my $addColor = "colorDefault";
1658       while (($top_section, $color_indices) = each %color_maps) {
1659           if (index ($element->{'sectionup'}->{'file'}, $top_section) >= 0) {
1660               $addColor = "color" . $color_indices->[$child_count];
1661           }
1662       }
1663       $this_css_class .= $addColor;
1664   }
1665   $this_css_class .= $is_parent_of_current ? ' toc_current"' : '"';
1666   my $entry = "$ind<li$this_css_class>" .
1667       &$anchor ($element->{'tocid'},
1668                 "$element->{'file'}#$element->{'target'}",
1669                 $element->{'text'});
1670
1671   push (@result, $entry);
1672   my $children = $element->{'section_childs'};
1673   if (defined($children) and (ref($children) eq "ARRAY")) {
1674     my $force_children = $is_parent_of_current or ($level == 1 and $element->{'number'});
1675     my @child_result = ();
1676     my $sub_child_count = 0;
1677     foreach my $c (@$children) {
1678       my $is_numbered_child = defined ($c->{'number'});
1679       my $below_maxlevel = $c->{'toc_level'} le $maxlevel;
1680       if ($force_children or ($is_numbered_child and $below_maxlevel)) {
1681         my @child_res =
1682             generate_ly_toc_entries($c, $element_path, $maxlevel, $sub_child_count, $current_element);
1683         push (@child_result, @child_res);
1684         $sub_child_count += 1;
1685       }
1686     }
1687     # if no child nodes were generated, e.g. for the index, where expanded pages
1688     # are ignored, don't generate a list at all...
1689     if (@child_result) {
1690       push (@result, "\n$ind<ul$NO_BULLET_LIST_ATTRIBUTE>\n");
1691       if ($web_manual) {
1692         push (@result, "$ind<li class=\"colorDefault" .
1693               ($element->{'text'} eq $current_element->{'text'} ?
1694                ' toc_current">' : '">') .
1695               &$anchor ($element->{'tocid'},
1696                         "$element->{'file'}#$element->{'target'}",
1697                         $element->{'text'}) . "</li>\n");
1698       }
1699       push (@result, @child_result);
1700       push (@result, "$ind</ul>\n");
1701     }
1702   }
1703   push (@result, "$ind</li>\n");
1704   return @result;
1705 }
1706
1707
1708 # Print a customized TOC, containing only the first two levels plus the whole
1709 # path to the current page
1710 sub lilypond_generate_page_toc_body($)
1711 {
1712     my $element = shift;
1713     my $current_element = $element;
1714     my %parentelements;
1715     $parentelements{$element->{'id'}} = 1;
1716     # Find the path to the current element
1717     while ( defined($current_element->{'sectionup'}) and
1718            ($current_element->{'sectionup'} ne $current_element) )
1719     {
1720       $parentelements{$current_element->{'sectionup'}->{'id'}} = 1
1721               if ($current_element->{'sectionup'}->{'id'} ne '');
1722       $current_element = $current_element->{'sectionup'};
1723       if ($web_manual) {
1724         if (exists($main::value{'shallow_toc'})) {
1725           last;
1726         }
1727       }
1728     }
1729     return () if not defined($current_element);
1730     # Create the toc entries recursively
1731     my @toc_entries = "";
1732     if ($web_manual) {
1733         @toc_entries = "<ul$NO_BULLET_LIST_ATTRIBUTE>\n";
1734         # FIXME: add link to main page, really hackily.
1735         if ($element->{'sectionup'}) {
1736             # it's not the top element
1737             push (@toc_entries, "<li><a href=\"index.html\">Main</a></li>\n");
1738         } else {
1739             push (@toc_entries,
1740                   "<li class=\"toc_current\"><a href=\"index.html\">Main</a></li>\n");
1741         }
1742     } else {
1743         push (@toc_entries, "<div class=\"contents\">\n");
1744         push (@toc_entries, "<ul$NO_BULLET_LIST_ATTRIBUTE>\n");
1745     }
1746     my $children = $current_element->{'section_childs'};
1747     foreach ( @$children ) {
1748       push (@toc_entries, generate_ly_toc_entries($_, \%parentelements, $page_toc_depth, 0, $element));
1749     }
1750     # search box
1751     #  I'm assuming that we wouldn't keep the google search box? -gp
1752     if (!($ENV{AJAX_SEARCH} == 1)) {
1753       local $/=undef;
1754       my $name = "search-box";
1755       $lang = $Texi2HTML::THISDOC{current_lang};
1756       open FILE, "$ENV{TOP_SRC_DIR}/Documentation/$lang/$name.ihtml" or
1757         open FILE, "$ENV{TOP_SRC_DIR}/Documentation/$name.ihtml"  or
1758         die "no such file: $name.ihtml: $!";
1759       my $search_string = decode ('UTF-8', <FILE>);
1760       $search_string = "<li>\n" . $search_string . "</li>\n";
1761       push (@toc_entries, $search_string);
1762       close FILE;
1763     }
1764
1765     push (@toc_entries, "</ul>\n");
1766     if ($web_manual) {
1767         push (@toc_entries, "\n");
1768     } else {
1769         push (@toc_entries, "</div>\n");
1770     }
1771     return @toc_entries;
1772 }
1773
1774 sub lilypond_print_toc_div ($$)
1775 {
1776   my $fh = shift;
1777   my $tocref = shift;
1778   my @lines = @$tocref;
1779   # use default TOC if no custom lines have been generated
1780   @lines = @default_toc if (not @lines);
1781   if (@lines) {
1782
1783     print $fh "\n\n<div id=\"tocframe\">\n";
1784
1785     # Remove the leading "GNU LilyPond --- " from the manual title
1786     my $topname = $Texi2HTML::NAME{'Top'};
1787     $topname =~ s/^GNU LilyPond(:| &[mn]dash;) //;
1788
1789     # construct the top-level Docs index (relative path and including language!)
1790     my $lang = $Texi2HTML::THISDOC{current_lang};
1791     if ($lang and $lang ne "en") {
1792       $lang .= ".";
1793     } else {
1794       $lang = "";
1795     }
1796     my $reldir = $ENV{DEPTH};
1797     # strip one depth level for translations
1798     if ($lang and $lang ne "en" and substr ($reldir, 0, 3) eq '../') {
1799         $reldir = substr ($reldir, 3);
1800     }
1801     # add a / at the end if there isn't one.
1802     if (substr ($reldir, -1) ne '/') {
1803         $reldir .= '/';
1804     }
1805     my $uplink = $reldir."Documentation/web/manuals.${lang}html";
1806
1807     if (not $web_manual) {
1808       print $fh "<p class=\"toc_uplink\"><a href=\"$uplink\"
1809          title=\"Documentation Index\">&lt;&lt; " .
1810          &ly_get_string ('Back to Documentation Index') .
1811          "</a></p>\n";
1812
1813       # AJAX search box, written in JavaScript
1814       if ($ENV{'AJAX_SEARCH'} == 1) {
1815         if ($have_index_entries) {
1816           my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'});
1817           print $fh '<script language="JavaScript">print_search_field ("' .
1818              $Texi2HTML::THISDOC{current_lang} . '", "' . 
1819              $docu_name . "\", " . $bigpage . ")</script>\n";
1820         }
1821       }
1822
1823       print $fh '<h4 class="toc_header"> ' . &$anchor('',
1824                                     $Texi2HTML::HREF{'Top'},
1825                                     $topname . " <!-- Sidebar Version Tag  --> ",
1826                                     'title="Start of the manual"'
1827                                    ) . "</h4>\n";
1828     }
1829
1830     foreach my $line (@lines) {
1831       print $fh $line;
1832     }
1833     print $fh "</div>\n\n";
1834   }
1835 }
1836
1837 # Create the custom TOC for this page (partially folded, current page is
1838 # highlighted) and store it in a global variable. The TOC is written out after
1839 # the html contents (but positioned correctly using CSS), so that browsers with
1840 # css turned off still show the contents first.
1841 our @this_page_toc = ();
1842 sub lilypond_print_element_header
1843 {
1844   my $first_in_page = shift;
1845   my $previous_is_top = shift;
1846   if ($first_in_page and not @this_page_toc) {
1847     if (defined($Texi2HTML::THIS_ELEMENT)) {
1848       # Create the TOC for this page
1849       @this_page_toc = lilypond_generate_page_toc_body($Texi2HTML::THIS_ELEMENT);
1850     }
1851   }
1852   return &$default_print_element_header( $first_in_page, $previous_is_top);
1853 }
1854
1855 # Generate the HTML output for the TOC
1856 sub lilypond_toc_body($)
1857 {
1858     my $elements_list = shift;
1859     # Generate a default TOC for pages without THIS_ELEMENT
1860     @default_toc = lilypond_generate_page_toc_body(@$elements_list[0]);
1861     return &$default_toc_body($elements_list);
1862 }
1863
1864 # Print out the TOC in a <div> at the beginning of the page
1865 sub lilypond_print_page_head($)
1866 {
1867     my $fh = shift;
1868     &$default_print_page_head($fh);
1869     print $fh "<div id=\"main\">\n";
1870 }
1871
1872 # Print out the TOC in a <div> at the end of th page, which will be formatted as a
1873 # sidebar mimicking a TOC frame
1874 sub print_lilypond_page_foot($)
1875 {
1876   my $fh = shift;
1877   my $program_string = &$program_string();
1878 #   print $fh "<p><font size='-1'>$program_string</font><br>$PRE_BODY_CLOSE</p>\n";
1879   print $fh "<!-- FOOTER -->\n\n";
1880   print $fh "<!-- end div#main here -->\n</div>\n\n";
1881   if ($web_manual) {
1882     # FIXME: This div and p#languages need to be in div#footer.
1883     #        Should we move this div to postprocess_html.py ?
1884     print $fh "<div id=\"verifier_texinfo\">\n";
1885     print $fh "<h3>Validation</h3>\n";
1886     # FIXME: inlined text substitution, move to ly_get_string as soon as another case is needed
1887     my $webdev_link = "<a href=\"http://www.webdev.nl/\">webdev.nl</a>";
1888     my $lily_site = "<code>lilypond.org</code>";
1889     my $hosting_thanks = &ly_get_string ('<p>Thanks to ${webdev_link} for hosting ${lily_site}.');
1890     # this does the variable substitution ("quoting" in Perlish) after the localization
1891     $hosting_thanks =~ s/(\$\{\w+\})/$1/eeg;
1892     print $fh $hosting_thanks . "\n";
1893     print $fh "<a href=\"http://validator.w3.org/check?uri=referer\">\n";
1894     print $fh "<img src=\"http://www.w3.org/Icons/valid-html401\"\n";
1895     print $fh "     alt=\"Valid HTML 4.01 Transitional\"\n";
1896     print $fh "     height=\"31\" width=\"88\"></a></p>\n";
1897     print $fh "</div>";
1898   }
1899
1900   # Print the TOC frame and reset the TOC:
1901   lilypond_print_toc_div ($fh, \@this_page_toc);
1902   @this_page_toc = ();
1903
1904   # Close the page:
1905   print $fh "</body>\n</html>\n";
1906 }
1907
1908
1909
1910
1911
1912 #############################################################################
1913 ###  NICER / MORE FLEXIBLE NAVIGATION PANELS
1914 #############################################################################
1915
1916 sub get_navigation_text
1917 {
1918   my $button = shift;
1919   my $text = $NAVIGATION_TEXT{$button};
1920   if ( ($button eq 'Back') or ($button eq 'FastBack') ) {
1921     $text = $text . $Texi2HTML::NODE{$button} . "&nbsp;";
1922   } elsif ( ($button eq 'Forward') or ($button eq 'FastForward') ) {
1923     $text = "&nbsp;" . $Texi2HTML::NODE{$button} . $text;
1924   } elsif ( $button eq 'Up' ) {
1925     $text = "&nbsp;".$text.":&nbsp;" . $Texi2HTML::NODE{$button} . "&nbsp;";
1926   }
1927   return $text;
1928 }
1929
1930
1931 # Don't automatically create left-aligned table cells for every link, but
1932 # instead create a <td> only on an appropriate '(left|right|center)-aligned-cell-n'
1933 # button text. It's alignment as well as the colspan will be taken from the
1934 # name of the button. Also, add 'newline' button text to create a new table
1935 # row. The texts of the buttons are generated by get_navigation_text and
1936 # will contain the name of the next/previous section/chapter.
1937 sub lilypond_print_navigation
1938 {
1939     my $buttons = shift;
1940     my $vertical = shift;
1941     my $spacing = 1;
1942     my $result = "<table class=\"nav_table\">\n";
1943
1944     $result .= "<tr>" unless $vertical;
1945     my $beginofline = 1;
1946     foreach my $button (@$buttons)
1947     {
1948         $result .= qq{<tr valign="top" align="left">\n} if $vertical;
1949         # Allow (left|right|center)-aligned-cell and newline as buttons!
1950         if ( $button =~ /^(.*)-aligned-cell-(.*)$/ )
1951         {
1952           $result .= qq{</td>} unless $beginofline;
1953           $result .= qq{<td valign="middle" align="$1" colspan="$2">};
1954           $beginofline = 0;
1955         }
1956         elsif ( $button eq 'newline' )
1957         {
1958           $result .= qq{</td>} unless $beginofline;
1959           $result .= qq{</tr>};
1960           $result .= qq{<tr>};
1961           $beginofline = 1;
1962
1963         }
1964         elsif (ref($button) eq 'CODE')
1965         {
1966             $result .= &$button($vertical);
1967         }
1968         elsif (ref($button) eq 'SCALAR')
1969         {
1970             $result .= "$$button" if defined($$button);
1971         }
1972         elsif (ref($button) eq 'ARRAY')
1973         {
1974             my $text = $button->[1];
1975             my $button_href = $button->[0];
1976             # verify that $button_href is simple text and text is a reference
1977             if (defined($button_href) and !ref($button_href)
1978                and defined($text) and (ref($text) eq 'SCALAR') and defined($$text))
1979             {             # use given text
1980                 if ($Texi2HTML::HREF{$button_href})
1981                 {
1982                   my $anchor_attributes = '';
1983                   if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button_href})) and
1984                       ($BUTTONS_ACCESSKEY{$button_href} ne ''))
1985                   {
1986                       $anchor_attributes = "accesskey=\"$BUTTONS_ACCESSKEY{$button_href}\"";
1987                   }
1988                   if ($USE_REL_REV and (defined($BUTTONS_REL{$button_href})) and
1989                       ($BUTTONS_REL{$button_href} ne ''))
1990                   {
1991                       $anchor_attributes .= " rel=\"$BUTTONS_REL{$button_href}\"";
1992                   }
1993                   $result .=  "" .
1994                         &$anchor('',
1995                                     $Texi2HTML::HREF{$button_href},
1996                                     get_navigation_text($$text),
1997                                     $anchor_attributes
1998                                    );
1999                 }
2000                 else
2001                 {
2002                   $result .=  get_navigation_text($$text);
2003                 }
2004             }
2005         }
2006         elsif ($button eq ' ')
2007         {                       # handle space button
2008             $result .=
2009                 ($ICONS && $ACTIVE_ICONS{' '}) ?
2010                     &$button_icon_img($BUTTONS_NAME{$button}, $ACTIVE_ICONS{' '}) :
2011                         $NAVIGATION_TEXT{' '};
2012             #next;
2013         }
2014         elsif ($Texi2HTML::HREF{$button})
2015         {                       # button is active
2016             my $btitle = $BUTTONS_GOTO{$button} ?
2017                 'title="' . $BUTTONS_GOTO{$button} . '"' : '';
2018             if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button})) and
2019                 ($BUTTONS_ACCESSKEY{$button} ne ''))
2020             {
2021                 $btitle .= " accesskey=\"$BUTTONS_ACCESSKEY{$button}\"";
2022             }
2023             if ($USE_REL_REV and (defined($BUTTONS_REL{$button})) and
2024                 ($BUTTONS_REL{$button} ne ''))
2025             {
2026                 $btitle .= " rel=\"$BUTTONS_REL{$button}\"";
2027             }
2028             if ($ICONS && $ACTIVE_ICONS{$button})
2029             {                   # use icon
2030                 $result .= '' .
2031                     &$anchor('',
2032                         $Texi2HTML::HREF{$button},
2033                         &$button_icon_img($BUTTONS_NAME{$button},
2034                                    $ACTIVE_ICONS{$button},
2035                                    $Texi2HTML::SIMPLE_TEXT{$button}),
2036                         $btitle
2037                       );
2038             }
2039             else
2040             {                   # use text
2041                 $result .=
2042                     '[' .
2043                         &$anchor('',
2044                                     $Texi2HTML::HREF{$button},
2045                                     get_navigation_text($button),
2046                                     $btitle
2047                                    ) .
2048                                        ']';
2049             }
2050         }
2051         else
2052         {                       # button is passive
2053             $result .=
2054                 $ICONS && $PASSIVE_ICONS{$button} ?
2055                     &$button_icon_img($BUTTONS_NAME{$button},
2056                                           $PASSIVE_ICONS{$button},
2057                                           $Texi2HTML::SIMPLE_TEXT{$button}) :
2058
2059                                               "[" . get_navigation_text($button) . "]";
2060         }
2061         $result .= "</td>\n" if $vertical;
2062         $result .= "</tr>\n" if $vertical;
2063     }
2064     $result .= "</td>" unless $beginofline;
2065     $result .= "</tr>" unless $vertical;
2066     $result .= "</table>\n";
2067     if ($web_manual) {
2068       return "\n";
2069     } else {
2070       return $result;
2071     }
2072 }
2073
2074
2075 @Texi2HTML::Config::SECTION_BUTTONS =
2076     ('left-aligned-cell-1', 'FastBack',
2077      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
2078      'right-aligned-cell-1', 'FastForward',
2079      'newline',
2080      'left-aligned-cell-2', 'Back',
2081      'center-aligned-cell-1', 'Up',
2082      'right-aligned-cell-2', 'Forward'
2083     );
2084
2085 # buttons for misc stuff
2086 @Texi2HTML::Config::MISC_BUTTONS = ('center-aligned-cell-3',
2087                                     'Top', 'Contents', 'Index', 'About');
2088
2089 # buttons for chapter file footers
2090 # (and headers but only if SECTION_NAVIGATION is false)
2091 @Texi2HTML::Config::CHAPTER_BUTTONS =
2092     ('left-aligned-cell-1', 'FastBack',
2093      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
2094      'right-aligned-cell-1', 'FastForward',
2095     );
2096
2097 # buttons for section file footers
2098 @Texi2HTML::Config::SECTION_FOOTER_BUTTONS =
2099     ('left-aligned-cell-1', 'FastBack',
2100      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
2101      'right-aligned-cell-1', 'FastForward',
2102      'newline',
2103      'left-aligned-cell-2', 'Back',
2104      'center-aligned-cell-1', 'Up',
2105      'right-aligned-cell-2', 'Forward'
2106     );
2107
2108 @Texi2HTML::Config::NODE_FOOTER_BUTTONS =
2109     ('left-aligned-cell-1', 'FastBack',
2110      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
2111      'right-aligned-cell-1', 'FastForward',
2112      'newline',
2113      'left-aligned-cell-2', 'Back',
2114      'center-aligned-cell-1', 'Up',
2115      'right-aligned-cell-2', 'Forward'
2116     );
2117
2118
2119
2120
2121
2122 #############################################################################
2123 ###  FOOTNOTE FORMATTING
2124 #############################################################################
2125
2126 # Format footnotes in a nicer way: Instead of printing the number in a separate
2127 # (nr) heading line, use the standard way of prepending <sup>nr</sup> immediately
2128 # before the fn text.
2129
2130
2131 # The following code is copied from texi2html's examples/makeinfo.init and
2132 # should be updated when texi2html makes some changes there!
2133
2134 my $makekinfo_like_footnote_absolute_number = 0;
2135
2136 sub makeinfo_like_foot_line_and_ref($$$$$$$$)
2137 {
2138     my $foot_num = shift;
2139     my $relative_num = shift;
2140     my $footid = shift;
2141     my $docid = shift;
2142     my $from_file = shift;
2143     my $footnote_file = shift;
2144     my $lines = shift;
2145     my $state = shift;
2146
2147     $makekinfo_like_footnote_absolute_number++;
2148
2149     # this is a bit obscure, this allows to add an anchor only if formatted
2150     # as part of the document.
2151     $docid = '' if ($state->{'outside_document'} or $state->{'multiple_pass'});
2152
2153     if ($from_file eq $footnote_file)
2154     {
2155         $from_file = $footnote_file = '';
2156     }
2157
2158     my $foot_anchor = "<sup>" .
2159         &$anchor($docid, "$footnote_file#$footid", $relative_num) . "</sup>";
2160     $foot_anchor = &$anchor($docid,
2161                             "$footnote_file#$footid",
2162                             "($relative_num)") if ($state->{'preformatted'});
2163
2164 #    unshift @$lines, "<li>";
2165 #    push @$lines, "</li>\n";
2166     return ($lines, $foot_anchor);
2167 }
2168
2169 sub makeinfo_like_foot_lines($)
2170 {
2171     my $lines = shift;
2172     unshift @$lines, "<hr>\n<h4>$Texi2HTML::I18n::WORDS->{'Footnotes_Title'}</h4>\n";
2173 #<ol type=\"1\">\n";
2174 #    push @$lines, "</ol>";
2175     return $lines;
2176 }
2177
2178 my %makekinfo_like_paragraph_in_footnote_nr;
2179
2180 sub makeinfo_like_paragraph ($$$$$$$$$$$$$)
2181 {
2182     my $text = shift;
2183     my $align = shift;
2184     my $indent = shift;
2185     my $paragraph_command = shift;
2186     my $paragraph_command_formatted = shift;
2187     my $paragraph_number = shift;
2188     my $format = shift;
2189     my $item_nr = shift;
2190     my $enumerate_style = shift;
2191     my $number = shift;
2192     my $command_stack_at_end = shift;
2193     my $command_stack_at_begin = shift;
2194     my $state = shift;
2195 #print STDERR "format: $format\n" if (defined($format));
2196 #print STDERR "paragraph @$command_stack_at_end; @$command_stack_at_begin\n";
2197     $paragraph_command_formatted = '' if (!defined($paragraph_command_formatted) or
2198           exists($special_list_commands{$format}->{$paragraph_command}));
2199     return '' if ($text =~ /^\s*$/);
2200     foreach my $style(t2h_collect_styles($command_stack_at_begin))
2201     {
2202        $text = t2h_begin_style($style, $text);
2203     }
2204     foreach my $style(t2h_collect_styles($command_stack_at_end))
2205     {
2206        $text = t2h_end_style($style, $text);
2207     }
2208     if (defined($paragraph_number) and defined($$paragraph_number))
2209     {
2210          $$paragraph_number++;
2211          return $text  if (($format eq 'itemize' or $format eq 'enumerate') and
2212             ($$paragraph_number == 1));
2213     }
2214     # The cells of a table should not be wrapped in a <p> tag, so just return the text
2215     if (defined($command_stack_at_begin->[0]) and $command_stack_at_begin->[0] eq 'multitable')
2216     {
2217         return $text;
2218     }
2219
2220     # Adjust all footnotes so that they look like good old makeinfo
2221     my $open = '<p';
2222     if ($align)
2223     {
2224         $open .= " align=\"$paragraph_style{$align}\"";
2225     }
2226     my $footnote_text = '';
2227     if (defined($command_stack_at_begin->[0]) and $command_stack_at_begin->[0] eq 'footnote')
2228     {
2229         my $state = $Texi2HTML::THISDOC{'state'};
2230         $makekinfo_like_paragraph_in_footnote_nr{$makekinfo_like_footnote_absolute_number}++;
2231         if ($makekinfo_like_paragraph_in_footnote_nr{$makekinfo_like_footnote_absolute_number} <= 1)
2232         {
2233            $open.=' class="footnote"';
2234            my $document_file = $state->{'footnote_document_file'};
2235            if ($document_file eq $state->{'footnote_footnote_file'})
2236            {
2237                $document_file = '';
2238            }
2239            my $docid = $state->{'footnote_place_id'};
2240            my $doc_state = $state->{'footnote_document_state'};
2241            $docid = '' if ($doc_state->{'outside_document'} or $doc_state->{'multiple_pass'});
2242            my $foot_label = &$anchor($state->{'footnote_footnote_id'},
2243                  $document_file . "#$state->{'footnote_place_id'}",
2244                  "$state->{'footnote_number_in_page'}");
2245            $footnote_text = "<small>[${foot_label}]</small> ";
2246         }
2247     }
2248     return $open.'>'.$footnote_text.$text.'</p>';
2249 }
2250
2251
2252 #############################################################################
2253 ###  WRITING OUT THE INDEX FOR THE AJAX SEARCH FIELD
2254 #############################################################################
2255
2256 $Texi2HTML::Config::IDX_SUMMARY   = 1;
2257 $Texi2HTML::Config::init_out                  = \&lilypond_init_out;
2258 $Texi2HTML::Config::finish_out                = \&lilypond_finish_out;
2259 $Texi2HTML::Config::index_summary_file_entry  = \&lilypond_index_summary_file_entry;
2260
2261 my @index_entries;
2262
2263 sub lilypond_init_out ()
2264 {
2265   t2h_default_init_out ();
2266   # Check whether we have an index at all! If not -> don't print out a search box!
2267   my $ix = main::get_index ("cp");
2268   $have_index_entries = (scalar $ix > 0);
2269 }
2270
2271 sub lilypond_index_summary_file_entry ($$$$$$$$$)
2272 {
2273   my $index_name = shift;
2274   my $entry_text = shift;
2275   my $entry_reference = shift;
2276   my $formatted_entry = shift;
2277   my $texi_entry = shift;
2278   my $entry_element_reference = shift;
2279   my $entry_element_header = shift;
2280   my $is_printed = shift;
2281   my $manual_name = shift;
2282
2283   if ($ENV{'AJAX_SEARCH'}==1) {
2284     if ($index_name eq "cp")
2285     {
2286       # The entries in the index file have the form:
2287       # SearchText \t FormattedText \t EntryURL \t SectionText \t SectionURL
2288       push @index_entries, "$entry_text\t$formatted_entry\t$entry_reference\t$entry_element_header\t$entry_element_reference\n";
2289     }
2290   }
2291 }
2292
2293 sub lilypond_finish_out ()
2294 {
2295   if ($ENV{'AJAX_SEARCH'}==1) {
2296     if (((scalar @index_entries) > 0) and $have_index_entries) {
2297       my $lang = $Texi2HTML::THISDOC{current_lang};
2298       my $big = "";
2299       $big = "-big-page" if $bigpage;
2300       my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'});
2301       my $idx_file = "$docu_dir/$docu_name$big.$lang.idx";
2302       open IDXOUTFILE, ">:utf8", $idx_file;
2303       print IDXOUTFILE @index_entries;
2304       close IDXOUTFILE;
2305     }
2306   }
2307 }
2308
2309
2310
2311 #############################################################################
2312 ###  OTHER SETTINGS
2313 #############################################################################
2314
2315 # For split pages, use index.html as start page!
2316 if ($Texi2HTML::Config::SPLIT eq 'section' or
2317     $Texi2HTML::Config::SPLIT eq 'node') {
2318   $Texi2HTML::Config::TOP_FILE = 'index.html';
2319 }
2320
2321
2322 return 1;