]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/lilypond-texi2html.init
Merge remote-tracking branch 'origin/translation' into staging
[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   ## This section makes the manual name visible to CSS through the body tag
1239   ## so that styles can be applied per manual. It will add the manual
1240   ## directory name (e.g., 'notation' or 'learning') as a CSS class, as well
1241   ## as a development status.
1242
1243   # Parse the input file name to determine the manual we're dealing with.
1244   my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'});
1245
1246   # Hard-coded value to indicate if this is a development version
1247   # ('devStatus') or stable version ('stableStatus')
1248   # TODO: Figure out how to automatically set this value based on the even/odd minor revision number or some other mechanism.
1249   $documentstatus = 'devStatus';
1250
1251   # Create the extra information for the <body> tag.
1252   # For example, the development Notation reference in English
1253   # will output in HTML as <body lang='en' class='notation devStatus'>
1254   $Texi2HTML::Config::BODYTEXT = 'lang="' . $Texi2HTML::THISDOC{current_lang} . '" class="' . $docu_name . ' ' . $documentstatus . '"';
1255
1256 }
1257
1258
1259
1260
1261
1262 #############################################################################
1263 ###  SPLITTING BASED ON NUMBERED SECTIONS
1264 #############################################################################
1265
1266 my $lastfilename;
1267 my $docnr = 0;
1268 my $node_to_filename_map = ();
1269 $source_to_translationof_map = ();
1270
1271
1272 # This function makes sure that files are only generated for numbered sections,
1273 # but not for unnumbered ones. It is called after texi2html has done its own
1274 # splitting and simply returns the filename for the node given as first argument
1275 # Nodes with the same filename will be printed out to the same filename, so
1276 # this really all we need. Also, make sure that the file names for sections
1277 # are derived from the section title. We also might want to name the anchors
1278 # according to node titles, which works by simply overriding the id element of
1279 # the $element hash.
1280 # If an external nodename<=>filename/anchor map file is found (loaded in
1281 # the command handler, use the externally created values, otherwise use the
1282 # same logic here.
1283 sub lilypond_element_file_name($$$)
1284 {
1285   my $element = shift;
1286   my $type = shift;
1287   my $docu_name = shift;
1288   my $docu_ext = $Texi2HTML::Config::EXTENSION;
1289
1290   my $node_name = main::remove_texi($element->{'node_ref'}->{'texi'});
1291   # the snippets page does not use nodes for the snippets, so in this case
1292   # we'll have to use the section name!
1293   if ($node_name eq '') {
1294     $node_name = main::remove_texi($element->{'texi'});
1295   }
1296
1297   # If we have an entry in the section<=>filename map, use that one, otherwise
1298   # generate the filename/anchor here. In the latter case, external manuals
1299   # will not be able to retrieve the file name for xrefs!!! Still, I already
1300   # had that code, so I'll leave it in in case something goes wrong with the
1301   # extract_texi_filenames.py script in the lilypond build process!
1302   if (exists ($node_to_filename_map->{$node_name})) {
1303     (my $filename, my $anchor) = @{$node_to_filename_map->{$node_name}};
1304     $filename .= ".$docu_ext" if (defined($docu_ext));
1305     # don't do lc_last here, otherwise the colors are messed up!
1306     $filename = lc($filename);
1307
1308     # unnumbered sections (except those at top-level!) always go to the same
1309     # file as the previous numbered section
1310     if (not ($web_manual) and not ($element->{number})
1311         and not ($lastfilename eq '') and ($element->{level} > 1)) {
1312       $filename = $lastfilename;
1313     }
1314     if (($filename eq $lastfilename)) {
1315       $$element{doc_nr} = $docnr;
1316     } else {
1317       $docnr += 1;
1318       $$element{doc_nr} = $docnr;
1319       $lastfilename = $filename;
1320     }
1321     #print STDERR "Output file name: $filename\n";
1322     $filename = lc_last($filename);
1323     return $filename;
1324
1325   } elsif ($type eq "top" or $type eq "toc" or $type eq "doc" or
1326            $type eq "stoc" or $type eq "foot" or $type eq "about") {
1327     return;
1328   } else {
1329     print STDERR "WARNING: Node '$node_name' was NOT found in the map\n"
1330         unless ($node_name eq '') or ($element->{'tag'} eq 'unnumberedsec')
1331                or ($node_name =~ /NOT REALLY USED/);
1332
1333     # Numbered sections will get a filename Node_title, unnumbered sections will use
1334     # the file name of the previous numbered section:
1335     if (($element->{number}) or ($lastfilename eq '') or ($element->{level} == 1)) {
1336       # normalize to the same file name as texinfo
1337       if ($element->{translationof}) {
1338         $node_name = main::remove_texi($element->{translationof});
1339       }
1340       my $filename = texinfo_file_name($node_name);
1341       $filename .= ".$docu_ext" if (defined($docu_ext));
1342       $filename = lc_last($filename);
1343       $docnr += 1;
1344       $$element{doc_nr} = $docnr;
1345       $lastfilename = $filename;
1346       print STDERR "File name: $filename\n";
1347       return $filename;
1348     } else {
1349       $$element{doc_nr} = $docnr;
1350       $filename = lc_last($filename);
1351       print STDERR "File name: $filename\n";
1352       return $filename;
1353     }
1354   }
1355
1356   return;
1357 }
1358
1359 sub lilypond_normalise_node($)
1360 {
1361     my $text = shift;
1362     my $norm = main::t2h_default_normalise_node($text);
1363     if (exists ($source_to_translationof_map->{$text})) {
1364         my $original = $source_to_translationof_map->{$text};
1365         $norm = main::t2h_default_normalise_node($original);
1366     }
1367
1368     return $norm;
1369 }
1370
1371 # This function produces an anchor.
1372 #
1373 # arguments:
1374 # $name           :   anchor name
1375 # $href           :   anchor href
1376 # text            :   text displayed
1377 # extra_attribs   :   added to anchor attributes list
1378 sub lilypond_anchor($;$$$)
1379 {
1380     my $name = shift;
1381     my $href = shift;
1382     my $text = shift;
1383     my $attributes = shift;
1384     $href = remove_unneeded_anchor($href);
1385     if (!defined($attributes) or ($attributes !~ /\S/))
1386     {
1387         $attributes = '';
1388     }
1389     else
1390     {
1391         $attributes = ' ' . $attributes;
1392     }
1393     $name = '' if (!defined($name) or ($name !~ /\S/));
1394     $href = '' if (!defined($href) or ($href !~ /\S/));
1395     $text = '' if (!defined($text));
1396     return $text if (($name eq '') and ($href eq ''));
1397     $name = "name=\"$name\"" if ($name ne '');
1398     $href = "href=\"$href\"" if ($href ne '');
1399     $href = ' ' . $href if (($name ne '') and ($href ne ''));
1400     return "<a ${name}${href}${attributes}>$text</a>";
1401 }
1402
1403
1404 sub lilypond_element_target_name($$$)
1405 {
1406   my $element = shift;
1407   my $target = shift;
1408   my $id = shift;
1409   # Target is based on node name (or sec name for secs without node attached)
1410   my $node_name = main::remove_texi($element->{'node_ref'}->{'texi'});
1411   if ($node_name eq '') {
1412     $node_name = main::remove_texi($element->{'texi'});
1413   }
1414
1415   # If we have an entry in the section<=>filename map, use that one, otherwise
1416   # generate the anchor here.
1417   if (exists ($node_to_filename_map->{$node_name})) {
1418     (my $filename, $target) = @{$node_to_filename_map->{$node_name}};
1419   } else {
1420     my $anchor = $node_name;
1421     if ($element->{translationof}) {
1422       $anchor = main::remove_texi($element->{translationof});
1423     }
1424     # normalize to the same file name as texinfo
1425     $target = texinfo_file_name($anchor);
1426   }
1427   # TODO: Once texi2html correctly prints out the target and not the id for
1428   #       the sections, change this back to ($id, $target)
1429   # I don't understand this comment, so I'm reluctant to delete it -gp
1430   $target = lc_last($target);
1431   $id = lc($target);
1432 # $id =~ s/-1$//i; # remove any trailing "-1"
1433   return ($target, $id);
1434 }
1435
1436
1437 ## Load the map file for the corrently processed texi file. We do this
1438 #  using a command init handler, since texi2html does not have any
1439 #  other hooks that are called after THISDOC is filled but before phase 2
1440 #  of the texi2html conversion.
1441 sub lilypond_init_map ()
1442 {
1443     my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'});
1444     my $map_filename = main::locate_include_file ("${docu_name}.$Texi2HTML::THISDOC{current_lang}.xref-map")
1445         || main::locate_include_file ("${docu_name}.xref-map");
1446     #print STDERR "Map filename is: $map_filename\nDocu name is $docu_name\n";
1447     if ($docu_name eq 'web') {
1448         $web_manual = 1;
1449         web_settings();
1450     }
1451     $node_to_filename_map = load_map_file ($map_filename);
1452 }
1453 push @Texi2HTML::Config::command_handler_init, \&lilypond_init_map;
1454
1455
1456
1457 #############################################################################
1458 ###  CLEANER LINK TITLE FOR EXTERNAL REFS
1459 #############################################################################
1460
1461 # The default formatting of external refs returns e.g.
1462 # "(lilypond-internals)Timing_translator", so we remove all (...) from the
1463 # file_and_node argument. Also, we want only a very simple format, so we don't
1464 # even call the default handler!
1465 sub lilypond_external_ref($$$$$$)
1466 {
1467   my $type = shift;
1468   my $section = shift;
1469   my $book = shift;
1470   my $file_node = shift;
1471   my $href = shift;
1472
1473   $href = lc_last($href);
1474
1475   my $cross_ref = shift;
1476
1477   my $displaytext = '';
1478
1479   # 1) if we have a cross ref name, that's the text to be displayed:
1480   # 2) For the top node, use the (printable) name of the manual, unless we
1481   #    have an explicit cross ref name
1482   # 3) In all other cases use the section name
1483   if ($cross_ref ne '') {
1484     $displaytext = $cross_ref;
1485   } elsif (($section eq '') or ($section eq 'Top')) {
1486     $displaytext = $book;
1487   } else {
1488     $displaytext = $section;
1489   }
1490
1491   $displaytext = &$anchor('', $href, $displaytext) if ($displaytext ne '');
1492   return &$I('%{node_file_href}', { 'node_file_href' => $displaytext });
1493 }
1494
1495
1496
1497
1498
1499 #############################################################################
1500 ###  HANDLING TRANSLATED SECTIONS: handle @translationof, secname<->filename
1501 ###                  map stored on disk, xrefs in other manuals load that map
1502 #############################################################################
1503
1504
1505 # Try to make use of @translationof to generate files according to the original
1506 # English section title...
1507 sub lilypond_unknown($$$$$)
1508 {
1509     my $macro = shift;
1510     my $line = shift;
1511     my $pass = shift;
1512     my $stack = shift;
1513     my $state = shift;
1514
1515     # the @translationof macro provides the original English section title,
1516     # which should be used for file/anchor naming, while the title will be
1517     # translated to each language
1518     # It is already used by extract_texi_filenames.py, so this should not be
1519     # necessary here at all. Still, I'll leave the code in just in case the
1520     # python script messed up ;-)
1521     if ($pass == 1 and $macro eq "translationof") {
1522       if (ref($state->{'element'}) eq 'HASH') {
1523           $state->{'element'}->{'translationof'} = main::normalise_space($line);
1524           my $source = main::normalise_space ($line);
1525           if (ref($state->{'node_ref'}) eq 'HASH') {
1526               my $translationof = $state->{'node_ref'}->{'texi'};
1527               our %source_to_translationof_map;
1528               $source_to_translationof_map->{$source} = $translationof;
1529           }
1530       }
1531       return ('', 1, undef, undef);
1532     } else {
1533       return &$default_unknown($macro, $line, $pass, $stack, $state);
1534     }
1535 }
1536
1537
1538 my %translated_books = ();
1539 # Construct a href to an external source of information.
1540 # node is the node with texinfo @-commands
1541 # node_id is the node transliterated and transformed as explained in the
1542 #         texinfo manual
1543 # node_xhtml_id is the node transformed such that it is unique and can
1544 #     be used to make an html cross ref as explained in the texinfo manual
1545 # file is the file in '(file)node'
1546 sub lilypond_external_href($$$)
1547 {
1548   my $node = shift;
1549   my $node_id = shift;
1550   my $node_xhtml_id = shift;
1551   my $file = shift;
1552
1553   # 1) Keep a hash of book->section_map
1554   # 2) if not file in keys hash => try to load the map (assign empty map if
1555   #    non-existent => will load only once!)
1556   # 3) if node in the section=>(file, anchor) map, replace node_id and
1557   #    node_xhtml_id by the map's values
1558   # 4) call the default_external_href with these values (or the old ones if not found)
1559
1560   if (($node_id ne '') and defined($file) and ($node_id ne 'Top')) {
1561     my $map_name = $file;
1562     $map_name =~ s/-big-page//;
1563
1564     # Load the map if we haven't done so already
1565     if (!exists($translated_books{$map_name})) {
1566       my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'});
1567       my $map_filename = main::locate_include_file ("${map_name}.$Texi2HTML::THISDOC{current_lang}.xref-map")
1568           || main::locate_include_file ("${map_name}.xref-map");
1569       $translated_books{$map_name} = load_map_file ($map_filename);
1570     }
1571
1572     # look up translation. use these values instead of the old filename/anchor
1573     my $section_name_map = $translated_books{$map_name};
1574     my $node_text = main::remove_texi($node);
1575     if (defined($section_name_map->{$node_text})) {
1576       ($node_id, $node_xhtml_id) = @{$section_name_map->{$node_text}};
1577     } else {
1578       print STDERR "WARNING: Unable to find node '$node_text' in book $map_name.\n";
1579     }
1580   }
1581
1582   if (defined $file) {
1583     $href = &$default_external_href($node, $node_id, $node_xhtml_id, lc_last($file));
1584     $href = remove_unneeded_anchor($href);
1585
1586     if ($web_manual) {
1587       my $only_web_version = $ENV{ONLY_WEB_VERSION};
1588       if ($only_web_version) {
1589         $href = "../../doc/".$only_web_version."/Documentation/web/".$href;
1590       }
1591     }
1592
1593     return $href;
1594   } else {
1595     $href = &$default_external_href($node, $node_id, $node_xhtml_id);
1596     $href = remove_unneeded_anchor($href);
1597     return $href;
1598   }
1599 }
1600
1601 sub remove_unneeded_anchor($)
1602 {
1603   my $href = shift;
1604   my @hrefsplit = split("/", $href);
1605   for ($i = 0; $i < @hrefsplit; $i++) {
1606     $item = @hrefsplit[$i];
1607     if ($item =~ /#/) {
1608       @split = split(".html#", $item);
1609       if (@split[0] eq @split[1]) {
1610         @hrefsplit[$i] = @split[0] . ".html";
1611       }
1612     }
1613   }
1614   $href = join("/", @hrefsplit);
1615   return $href
1616 }
1617
1618
1619
1620 #############################################################################
1621 ###  CUSTOM TOC FOR EACH PAGE (in a frame on the left)
1622 #############################################################################
1623
1624 my $page_toc_depth = 2;
1625 my @default_toc = [];
1626
1627 # Initialize the toc_depth to 1 if the command-line option -D=short_toc is given
1628 sub lilypond_init_toc_depth ()
1629 {
1630   if (exists($main::value{'short_toc'}) and not exists($main::value{'bigpage'})
1631       and not $web_manual) {
1632     $page_toc_depth = 1;
1633   }
1634 }
1635 # Set the TOC-depth (depending on a texinfo variable short_toc) in a
1636 # command-handler, so we have them available when creating the pages
1637 push @Texi2HTML::Config::command_handler_process, \&lilypond_init_toc_depth;
1638
1639
1640
1641 # recursively generate the TOC entries for the element and its children (which
1642 # are only shown up to maxlevel. All ancestors of the current element are also
1643 # shown with their immediate children, irrespective of their level.
1644 # Unnumbered entries are only printed out if they are at top-level or 2nd level
1645 # or their parent element is an ancestor of the currently viewed node.
1646 # The conditions to call this method to print the entry for a child node is:
1647 # -) the parent is an ancestor of the current page node
1648 # -) the parent is a numbered element at top-level toplevel (i.e. show numbered
1649 #    and unnumbered 2nd-level children of numbered nodes)
1650 # -) the child element is a numbered node below level maxlevel
1651 sub generate_ly_toc_entries($$$$$)
1652 {
1653   my $element = shift;
1654   my $element_path = shift;
1655   my $maxlevel = shift;
1656   if ($web_manual) {
1657     $maxlevel = 1;
1658   }
1659   my $child_count = shift;
1660   my $current_element = shift;
1661   # Skip undefined sections, plus all sections generated by index splitting
1662   return() if (not defined($element) or exists($element->{'index_page'}));
1663   my @result = ();
1664   my $level = $element->{'toc_level'};
1665   my $is_parent_of_current = $element->{'id'} && $element_path->{$element->{'id'}};
1666   my $ind = '  ' x $level;
1667   my $this_css_class = " class=\"";
1668   # color indices for the second navigation bar on the website
1669   if ($web_manual) {
1670       my %color_maps = (
1671           'introduction' => [2, 2, 2, 2, 3, 3, 4, 4],
1672           'download' => [2, 2, 2, 3, 3, 4],
1673           'manuals' => [1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4],
1674           'community' => [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4],
1675           );
1676       my $addColor = "colorDefault";
1677       while (($top_section, $color_indices) = each %color_maps) {
1678           if (index ($element->{'sectionup'}->{'file'}, $top_section) >= 0) {
1679               $addColor = "color" . $color_indices->[$child_count];
1680           }
1681       }
1682       $this_css_class .= $addColor;
1683   }
1684   $this_css_class .= $is_parent_of_current ? ' toc_current"' : '"';
1685   my $entry = "$ind<li$this_css_class>" .
1686       &$anchor ($element->{'tocid'},
1687                 "$element->{'file'}#$element->{'target'}",
1688                 $element->{'text'});
1689
1690   push (@result, $entry);
1691   my $children = $element->{'section_childs'};
1692   if (defined($children) and (ref($children) eq "ARRAY")) {
1693     my $force_children = $is_parent_of_current or ($level == 1 and $element->{'number'});
1694     my @child_result = ();
1695     my $sub_child_count = 0;
1696     foreach my $c (@$children) {
1697       my $is_numbered_child = defined ($c->{'number'});
1698       my $below_maxlevel = $c->{'toc_level'} le $maxlevel;
1699       if ($force_children or ($is_numbered_child and $below_maxlevel)) {
1700         my @child_res =
1701             generate_ly_toc_entries($c, $element_path, $maxlevel, $sub_child_count, $current_element);
1702         push (@child_result, @child_res);
1703         $sub_child_count += 1;
1704       }
1705     }
1706     # if no child nodes were generated, e.g. for the index, where expanded pages
1707     # are ignored, don't generate a list at all...
1708     if (@child_result) {
1709       push (@result, "\n$ind<ul$NO_BULLET_LIST_ATTRIBUTE>\n");
1710       if ($web_manual) {
1711         push (@result, "$ind<li class=\"colorDefault" .
1712               ($element->{'text'} eq $current_element->{'text'} ?
1713                ' toc_current">' : '">') .
1714               &$anchor ($element->{'tocid'},
1715                         "$element->{'file'}#$element->{'target'}",
1716                         $element->{'text'}) . "</li>\n");
1717       }
1718       push (@result, @child_result);
1719       push (@result, "$ind</ul>\n");
1720     }
1721   }
1722   push (@result, "$ind</li>\n");
1723   return @result;
1724 }
1725
1726
1727 # Print a customized TOC, containing only the first two levels plus the whole
1728 # path to the current page
1729 sub lilypond_generate_page_toc_body($)
1730 {
1731     my $element = shift;
1732     my $current_element = $element;
1733     my %parentelements;
1734     $parentelements{$element->{'id'}} = 1;
1735     # Find the path to the current element
1736     while ( defined($current_element->{'sectionup'}) and
1737            ($current_element->{'sectionup'} ne $current_element) )
1738     {
1739       $parentelements{$current_element->{'sectionup'}->{'id'}} = 1
1740               if ($current_element->{'sectionup'}->{'id'} ne '');
1741       $current_element = $current_element->{'sectionup'};
1742       if ($web_manual) {
1743         if (exists($main::value{'shallow_toc'})) {
1744           last;
1745         }
1746       }
1747     }
1748     return () if not defined($current_element);
1749     # Create the toc entries recursively
1750     my @toc_entries = "";
1751     if ($web_manual) {
1752         @toc_entries = "<ul$NO_BULLET_LIST_ATTRIBUTE>\n";
1753         # FIXME: add link to main page, really hackily.
1754         if ($element->{'sectionup'}) {
1755             # it's not the top element
1756             push (@toc_entries, "<li><a href=\"index.html\">Main</a></li>\n");
1757         } else {
1758             push (@toc_entries,
1759                   "<li class=\"toc_current\"><a href=\"index.html\">Main</a></li>\n");
1760         }
1761     } else {
1762         push (@toc_entries, "<div class=\"contents\">\n");
1763         push (@toc_entries, "<ul$NO_BULLET_LIST_ATTRIBUTE>\n");
1764     }
1765     my $children = $current_element->{'section_childs'};
1766     foreach ( @$children ) {
1767       push (@toc_entries, generate_ly_toc_entries($_, \%parentelements, $page_toc_depth, 0, $element));
1768     }
1769     # search box
1770     #  I'm assuming that we wouldn't keep the google search box? -gp
1771     if (!($ENV{AJAX_SEARCH} == 1)) {
1772       local $/=undef;
1773       my $name = "search-box";
1774       $lang = $Texi2HTML::THISDOC{current_lang};
1775       open FILE, "$ENV{TOP_SRC_DIR}/Documentation/$lang/$name.ihtml" or
1776         open FILE, "$ENV{TOP_SRC_DIR}/Documentation/$name.ihtml"  or
1777         die "no such file: $name.ihtml: $!";
1778       my $search_string = decode ('UTF-8', <FILE>);
1779       $search_string = "<li>\n" . $search_string . "</li>\n";
1780       push (@toc_entries, $search_string);
1781       close FILE;
1782     }
1783
1784     push (@toc_entries, "</ul>\n");
1785     if ($web_manual) {
1786         push (@toc_entries, "\n");
1787     } else {
1788         push (@toc_entries, "</div>\n");
1789     }
1790     return @toc_entries;
1791 }
1792
1793 sub lilypond_print_toc_div ($$)
1794 {
1795   my $fh = shift;
1796   my $tocref = shift;
1797   my @lines = @$tocref;
1798   # use default TOC if no custom lines have been generated
1799   @lines = @default_toc if (not @lines);
1800   if (@lines) {
1801
1802     print $fh "\n\n<div id=\"tocframe\">\n";
1803
1804     # Remove the leading "GNU LilyPond --- " from the manual title
1805     my $topname = $Texi2HTML::NAME{'Top'};
1806     $topname =~ s/^GNU LilyPond(:| &[mn]dash;) //;
1807
1808     # construct the top-level Docs index (relative path and including language!)
1809     my $lang = $Texi2HTML::THISDOC{current_lang};
1810     if ($lang and $lang ne "en") {
1811       $lang .= ".";
1812     } else {
1813       $lang = "";
1814     }
1815     my $reldir = $ENV{DEPTH};
1816     # strip one depth level for translations
1817     if ($lang and $lang ne "en" and substr ($reldir, 0, 3) eq '../') {
1818         $reldir = substr ($reldir, 3);
1819     }
1820     # add a / at the end if there isn't one.
1821     if (substr ($reldir, -1) ne '/') {
1822         $reldir .= '/';
1823     }
1824     my $uplink = $reldir."Documentation/web/manuals.${lang}html";
1825
1826     if (not $web_manual) {
1827       print $fh "<p class=\"toc_uplink\"><a href=\"$uplink\"
1828          title=\"Documentation Index\">&lt;&lt; " .
1829          &ly_get_string ('Back to Documentation Index') .
1830          "</a></p>\n";
1831
1832       # AJAX search box, written in JavaScript
1833       if ($ENV{'AJAX_SEARCH'} == 1) {
1834         if ($have_index_entries) {
1835           my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'});
1836           print $fh '<script language="JavaScript">print_search_field ("' .
1837              $Texi2HTML::THISDOC{current_lang} . '", "' . 
1838              $docu_name . "\", " . $bigpage . ")</script>\n";
1839         }
1840       }
1841
1842       print $fh '<h4 class="toc_header"> ' . &$anchor('',
1843                                     $Texi2HTML::HREF{'Top'},
1844                                     $topname . " <!-- Sidebar Version Tag  --> ",
1845                                     'title="Start of the manual"'
1846                                    ) . "</h4>\n";
1847     }
1848
1849     foreach my $line (@lines) {
1850       print $fh $line;
1851     }
1852     print $fh "</div>\n\n";
1853   }
1854 }
1855
1856 # Create the custom TOC for this page (partially folded, current page is
1857 # highlighted) and store it in a global variable. The TOC is written out after
1858 # the html contents (but positioned correctly using CSS), so that browsers with
1859 # css turned off still show the contents first.
1860 our @this_page_toc = ();
1861 sub lilypond_print_element_header
1862 {
1863   my $first_in_page = shift;
1864   my $previous_is_top = shift;
1865   if ($first_in_page and not @this_page_toc) {
1866     if (defined($Texi2HTML::THIS_ELEMENT)) {
1867       # Create the TOC for this page
1868       @this_page_toc = lilypond_generate_page_toc_body($Texi2HTML::THIS_ELEMENT);
1869     }
1870   }
1871   return &$default_print_element_header( $first_in_page, $previous_is_top);
1872 }
1873
1874 # Generate the HTML output for the TOC
1875 sub lilypond_toc_body($)
1876 {
1877     my $elements_list = shift;
1878     # Generate a default TOC for pages without THIS_ELEMENT
1879     @default_toc = lilypond_generate_page_toc_body(@$elements_list[0]);
1880     return &$default_toc_body($elements_list);
1881 }
1882
1883 # Print out the TOC in a <div> at the beginning of the page
1884 sub lilypond_print_page_head($)
1885 {
1886     my $fh = shift;
1887     &$default_print_page_head($fh);
1888     print $fh "<div id=\"main\">\n";
1889 }
1890
1891 # Print out the TOC in a <div> at the end of th page, which will be formatted as a
1892 # sidebar mimicking a TOC frame
1893 sub print_lilypond_page_foot($)
1894 {
1895   my $fh = shift;
1896   my $program_string = &$program_string();
1897 #   print $fh "<p><font size='-1'>$program_string</font><br>$PRE_BODY_CLOSE</p>\n";
1898   print $fh "<!-- FOOTER -->\n\n";
1899   print $fh "<!-- end div#main here -->\n</div>\n\n";
1900   if ($web_manual) {
1901     # FIXME: This div and p#languages need to be in div#footer.
1902     #        Should we move this div to postprocess_html.py ?
1903     print $fh "<div id=\"verifier_texinfo\">\n";
1904     print $fh "<h3>Validation</h3>\n";
1905     # FIXME: inlined text substitution, move to ly_get_string as soon as another case is needed
1906     my $webdev_link = "<a href=\"http://www.webdev.nl/\">webdev.nl</a>";
1907     my $lily_site = "<code>lilypond.org</code>";
1908     my $hosting_thanks = &ly_get_string ('<p>Thanks to ${webdev_link} for hosting ${lily_site}.');
1909     # this does the variable substitution ("quoting" in Perlish) after the localization
1910     $hosting_thanks =~ s/(\$\{\w+\})/$1/eeg;
1911     print $fh $hosting_thanks . "\n";
1912     print $fh "<a href=\"http://validator.w3.org/check?uri=referer\">\n";
1913     print $fh "<img src=\"http://www.w3.org/Icons/valid-html401\"\n";
1914     print $fh "     alt=\"Valid HTML 4.01 Transitional\"\n";
1915     print $fh "     height=\"31\" width=\"88\"></a></p>\n";
1916     print $fh "</div>";
1917   }
1918
1919   # Print the TOC frame and reset the TOC:
1920   lilypond_print_toc_div ($fh, \@this_page_toc);
1921   @this_page_toc = ();
1922
1923   # Close the page:
1924   print $fh "</body>\n</html>\n";
1925 }
1926
1927
1928
1929
1930
1931 #############################################################################
1932 ###  NICER / MORE FLEXIBLE NAVIGATION PANELS
1933 #############################################################################
1934
1935 sub get_navigation_text
1936 {
1937   my $button = shift;
1938   my $text = $NAVIGATION_TEXT{$button};
1939   if ( ($button eq 'Back') or ($button eq 'FastBack') ) {
1940     $text = $text . $Texi2HTML::NODE{$button} . "&nbsp;";
1941   } elsif ( ($button eq 'Forward') or ($button eq 'FastForward') ) {
1942     $text = "&nbsp;" . $Texi2HTML::NODE{$button} . $text;
1943   } elsif ( $button eq 'Up' ) {
1944     $text = "&nbsp;".$text.":&nbsp;" . $Texi2HTML::NODE{$button} . "&nbsp;";
1945   }
1946   return $text;
1947 }
1948
1949
1950 # Don't automatically create left-aligned table cells for every link, but
1951 # instead create a <td> only on an appropriate '(left|right|center)-aligned-cell-n'
1952 # button text. It's alignment as well as the colspan will be taken from the
1953 # name of the button. Also, add 'newline' button text to create a new table
1954 # row. The texts of the buttons are generated by get_navigation_text and
1955 # will contain the name of the next/previous section/chapter.
1956 sub lilypond_print_navigation
1957 {
1958     my $buttons = shift;
1959     my $vertical = shift;
1960     my $spacing = 1;
1961     my $result = "<table class=\"nav_table\">\n";
1962
1963     $result .= "<tr>" unless $vertical;
1964     my $beginofline = 1;
1965     foreach my $button (@$buttons)
1966     {
1967         $result .= qq{<tr valign="top" align="left">\n} if $vertical;
1968         # Allow (left|right|center)-aligned-cell and newline as buttons!
1969         if ( $button =~ /^(.*)-aligned-cell-(.*)$/ )
1970         {
1971           $result .= qq{</td>} unless $beginofline;
1972           $result .= qq{<td valign="middle" align="$1" colspan="$2">};
1973           $beginofline = 0;
1974         }
1975         elsif ( $button eq 'newline' )
1976         {
1977           $result .= qq{</td>} unless $beginofline;
1978           $result .= qq{</tr>};
1979           $result .= qq{<tr>};
1980           $beginofline = 1;
1981
1982         }
1983         elsif (ref($button) eq 'CODE')
1984         {
1985             $result .= &$button($vertical);
1986         }
1987         elsif (ref($button) eq 'SCALAR')
1988         {
1989             $result .= "$$button" if defined($$button);
1990         }
1991         elsif (ref($button) eq 'ARRAY')
1992         {
1993             my $text = $button->[1];
1994             my $button_href = $button->[0];
1995             # verify that $button_href is simple text and text is a reference
1996             if (defined($button_href) and !ref($button_href)
1997                and defined($text) and (ref($text) eq 'SCALAR') and defined($$text))
1998             {             # use given text
1999                 if ($Texi2HTML::HREF{$button_href})
2000                 {
2001                   my $anchor_attributes = '';
2002                   if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button_href})) and
2003                       ($BUTTONS_ACCESSKEY{$button_href} ne ''))
2004                   {
2005                       $anchor_attributes = "accesskey=\"$BUTTONS_ACCESSKEY{$button_href}\"";
2006                   }
2007                   if ($USE_REL_REV and (defined($BUTTONS_REL{$button_href})) and
2008                       ($BUTTONS_REL{$button_href} ne ''))
2009                   {
2010                       $anchor_attributes .= " rel=\"$BUTTONS_REL{$button_href}\"";
2011                   }
2012                   $result .=  "" .
2013                         &$anchor('',
2014                                     $Texi2HTML::HREF{$button_href},
2015                                     get_navigation_text($$text),
2016                                     $anchor_attributes
2017                                    );
2018                 }
2019                 else
2020                 {
2021                   $result .=  get_navigation_text($$text);
2022                 }
2023             }
2024         }
2025         elsif ($button eq ' ')
2026         {                       # handle space button
2027             $result .=
2028                 ($ICONS && $ACTIVE_ICONS{' '}) ?
2029                     &$button_icon_img($BUTTONS_NAME{$button}, $ACTIVE_ICONS{' '}) :
2030                         $NAVIGATION_TEXT{' '};
2031             #next;
2032         }
2033         elsif ($Texi2HTML::HREF{$button})
2034         {                       # button is active
2035             my $btitle = $BUTTONS_GOTO{$button} ?
2036                 'title="' . $BUTTONS_GOTO{$button} . '"' : '';
2037             if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button})) and
2038                 ($BUTTONS_ACCESSKEY{$button} ne ''))
2039             {
2040                 $btitle .= " accesskey=\"$BUTTONS_ACCESSKEY{$button}\"";
2041             }
2042             if ($USE_REL_REV and (defined($BUTTONS_REL{$button})) and
2043                 ($BUTTONS_REL{$button} ne ''))
2044             {
2045                 $btitle .= " rel=\"$BUTTONS_REL{$button}\"";
2046             }
2047             if ($ICONS && $ACTIVE_ICONS{$button})
2048             {                   # use icon
2049                 $result .= '' .
2050                     &$anchor('',
2051                         $Texi2HTML::HREF{$button},
2052                         &$button_icon_img($BUTTONS_NAME{$button},
2053                                    $ACTIVE_ICONS{$button},
2054                                    $Texi2HTML::SIMPLE_TEXT{$button}),
2055                         $btitle
2056                       );
2057             }
2058             else
2059             {                   # use text
2060                 $result .=
2061                     '[' .
2062                         &$anchor('',
2063                                     $Texi2HTML::HREF{$button},
2064                                     get_navigation_text($button),
2065                                     $btitle
2066                                    ) .
2067                                        ']';
2068             }
2069         }
2070         else
2071         {                       # button is passive
2072             $result .=
2073                 $ICONS && $PASSIVE_ICONS{$button} ?
2074                     &$button_icon_img($BUTTONS_NAME{$button},
2075                                           $PASSIVE_ICONS{$button},
2076                                           $Texi2HTML::SIMPLE_TEXT{$button}) :
2077
2078                                               "[" . get_navigation_text($button) . "]";
2079         }
2080         $result .= "</td>\n" if $vertical;
2081         $result .= "</tr>\n" if $vertical;
2082     }
2083     $result .= "</td>" unless $beginofline;
2084     $result .= "</tr>" unless $vertical;
2085     $result .= "</table>\n";
2086     if ($web_manual) {
2087       return "\n";
2088     } else {
2089       return $result;
2090     }
2091 }
2092
2093
2094 @Texi2HTML::Config::SECTION_BUTTONS =
2095     ('left-aligned-cell-1', 'FastBack',
2096      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
2097      'right-aligned-cell-1', 'FastForward',
2098      'newline',
2099      'left-aligned-cell-2', 'Back',
2100      'center-aligned-cell-1', 'Up',
2101      'right-aligned-cell-2', 'Forward'
2102     );
2103
2104 # buttons for misc stuff
2105 @Texi2HTML::Config::MISC_BUTTONS = ('center-aligned-cell-3',
2106                                     'Top', 'Contents', 'Index', 'About');
2107
2108 # buttons for chapter file footers
2109 # (and headers but only if SECTION_NAVIGATION is false)
2110 @Texi2HTML::Config::CHAPTER_BUTTONS =
2111     ('left-aligned-cell-1', 'FastBack',
2112      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
2113      'right-aligned-cell-1', 'FastForward',
2114     );
2115
2116 # buttons for section file footers
2117 @Texi2HTML::Config::SECTION_FOOTER_BUTTONS =
2118     ('left-aligned-cell-1', 'FastBack',
2119      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
2120      'right-aligned-cell-1', 'FastForward',
2121      'newline',
2122      'left-aligned-cell-2', 'Back',
2123      'center-aligned-cell-1', 'Up',
2124      'right-aligned-cell-2', 'Forward'
2125     );
2126
2127 @Texi2HTML::Config::NODE_FOOTER_BUTTONS =
2128     ('left-aligned-cell-1', 'FastBack',
2129      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
2130      'right-aligned-cell-1', 'FastForward',
2131      'newline',
2132      'left-aligned-cell-2', 'Back',
2133      'center-aligned-cell-1', 'Up',
2134      'right-aligned-cell-2', 'Forward'
2135     );
2136
2137
2138
2139
2140
2141 #############################################################################
2142 ###  FOOTNOTE FORMATTING
2143 #############################################################################
2144
2145 # Format footnotes in a nicer way: Instead of printing the number in a separate
2146 # (nr) heading line, use the standard way of prepending <sup>nr</sup> immediately
2147 # before the fn text.
2148
2149
2150 # The following code is copied from texi2html's examples/makeinfo.init and
2151 # should be updated when texi2html makes some changes there!
2152
2153 my $makekinfo_like_footnote_absolute_number = 0;
2154
2155 sub makeinfo_like_foot_line_and_ref($$$$$$$$)
2156 {
2157     my $foot_num = shift;
2158     my $relative_num = shift;
2159     my $footid = shift;
2160     my $docid = shift;
2161     my $from_file = shift;
2162     my $footnote_file = shift;
2163     my $lines = shift;
2164     my $state = shift;
2165
2166     $makekinfo_like_footnote_absolute_number++;
2167
2168     # this is a bit obscure, this allows to add an anchor only if formatted
2169     # as part of the document.
2170     $docid = '' if ($state->{'outside_document'} or $state->{'multiple_pass'});
2171
2172     if ($from_file eq $footnote_file)
2173     {
2174         $from_file = $footnote_file = '';
2175     }
2176
2177     my $foot_anchor = "<sup>" .
2178         &$anchor($docid, "$footnote_file#$footid", $relative_num) . "</sup>";
2179     $foot_anchor = &$anchor($docid,
2180                             "$footnote_file#$footid",
2181                             "($relative_num)") if ($state->{'preformatted'});
2182
2183 #    unshift @$lines, "<li>";
2184 #    push @$lines, "</li>\n";
2185     return ($lines, $foot_anchor);
2186 }
2187
2188 sub makeinfo_like_foot_lines($)
2189 {
2190     my $lines = shift;
2191     unshift @$lines, "<hr>\n<h4>$Texi2HTML::I18n::WORDS->{'Footnotes_Title'}</h4>\n";
2192 #<ol type=\"1\">\n";
2193 #    push @$lines, "</ol>";
2194     return $lines;
2195 }
2196
2197 my %makekinfo_like_paragraph_in_footnote_nr;
2198
2199 sub makeinfo_like_paragraph ($$$$$$$$$$$$$)
2200 {
2201     my $text = shift;
2202     my $align = shift;
2203     my $indent = shift;
2204     my $paragraph_command = shift;
2205     my $paragraph_command_formatted = shift;
2206     my $paragraph_number = shift;
2207     my $format = shift;
2208     my $item_nr = shift;
2209     my $enumerate_style = shift;
2210     my $number = shift;
2211     my $command_stack_at_end = shift;
2212     my $command_stack_at_begin = shift;
2213     my $state = shift;
2214 #print STDERR "format: $format\n" if (defined($format));
2215 #print STDERR "paragraph @$command_stack_at_end; @$command_stack_at_begin\n";
2216     $paragraph_command_formatted = '' if (!defined($paragraph_command_formatted) or
2217           exists($special_list_commands{$format}->{$paragraph_command}));
2218     return '' if ($text =~ /^\s*$/);
2219     foreach my $style(t2h_collect_styles($command_stack_at_begin))
2220     {
2221        $text = t2h_begin_style($style, $text);
2222     }
2223     foreach my $style(t2h_collect_styles($command_stack_at_end))
2224     {
2225        $text = t2h_end_style($style, $text);
2226     }
2227     if (defined($paragraph_number) and defined($$paragraph_number))
2228     {
2229          $$paragraph_number++;
2230          return $text  if (($format eq 'itemize' or $format eq 'enumerate') and
2231             ($$paragraph_number == 1));
2232     }
2233     # The cells of a table should not be wrapped in a <p> tag, so just return the text
2234     if (defined($command_stack_at_begin->[0]) and $command_stack_at_begin->[0] eq 'multitable')
2235     {
2236         return $text;
2237     }
2238
2239     # Adjust all footnotes so that they look like good old makeinfo
2240     my $open = '<p';
2241     if ($align)
2242     {
2243         $open .= " align=\"$paragraph_style{$align}\"";
2244     }
2245     my $footnote_text = '';
2246     if (defined($command_stack_at_begin->[0]) and $command_stack_at_begin->[0] eq 'footnote')
2247     {
2248         my $state = $Texi2HTML::THISDOC{'state'};
2249         $makekinfo_like_paragraph_in_footnote_nr{$makekinfo_like_footnote_absolute_number}++;
2250         if ($makekinfo_like_paragraph_in_footnote_nr{$makekinfo_like_footnote_absolute_number} <= 1)
2251         {
2252            $open.=' class="footnote"';
2253            my $document_file = $state->{'footnote_document_file'};
2254            if ($document_file eq $state->{'footnote_footnote_file'})
2255            {
2256                $document_file = '';
2257            }
2258            my $docid = $state->{'footnote_place_id'};
2259            my $doc_state = $state->{'footnote_document_state'};
2260            $docid = '' if ($doc_state->{'outside_document'} or $doc_state->{'multiple_pass'});
2261            my $foot_label = &$anchor($state->{'footnote_footnote_id'},
2262                  $document_file . "#$state->{'footnote_place_id'}",
2263                  "$state->{'footnote_number_in_page'}");
2264            $footnote_text = "<small>[${foot_label}]</small> ";
2265         }
2266     }
2267     return $open.'>'.$footnote_text.$text.'</p>';
2268 }
2269
2270
2271 #############################################################################
2272 ###  WRITING OUT THE INDEX FOR THE AJAX SEARCH FIELD
2273 #############################################################################
2274
2275 $Texi2HTML::Config::IDX_SUMMARY   = 1;
2276 $Texi2HTML::Config::init_out                  = \&lilypond_init_out;
2277 $Texi2HTML::Config::finish_out                = \&lilypond_finish_out;
2278 $Texi2HTML::Config::index_summary_file_entry  = \&lilypond_index_summary_file_entry;
2279
2280 my @index_entries;
2281
2282 sub lilypond_init_out ()
2283 {
2284   t2h_default_init_out ();
2285   # Check whether we have an index at all! If not -> don't print out a search box!
2286   my $ix = main::get_index ("cp");
2287   $have_index_entries = (scalar $ix > 0);
2288 }
2289
2290 sub lilypond_index_summary_file_entry ($$$$$$$$$)
2291 {
2292   my $index_name = shift;
2293   my $entry_text = shift;
2294   my $entry_reference = shift;
2295   my $formatted_entry = shift;
2296   my $texi_entry = shift;
2297   my $entry_element_reference = shift;
2298   my $entry_element_header = shift;
2299   my $is_printed = shift;
2300   my $manual_name = shift;
2301
2302   if ($ENV{'AJAX_SEARCH'}==1) {
2303     if ($index_name eq "cp")
2304     {
2305       # The entries in the index file have the form:
2306       # SearchText \t FormattedText \t EntryURL \t SectionText \t SectionURL
2307       push @index_entries, "$entry_text\t$formatted_entry\t$entry_reference\t$entry_element_header\t$entry_element_reference\n";
2308     }
2309   }
2310 }
2311
2312 sub lilypond_finish_out ()
2313 {
2314   if ($ENV{'AJAX_SEARCH'}==1) {
2315     if (((scalar @index_entries) > 0) and $have_index_entries) {
2316       my $lang = $Texi2HTML::THISDOC{current_lang};
2317       my $big = "";
2318       $big = "-big-page" if $bigpage;
2319       my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'});
2320       my $idx_file = "$docu_dir/$docu_name$big.$lang.idx";
2321       open IDXOUTFILE, ">:utf8", $idx_file;
2322       print IDXOUTFILE @index_entries;
2323       close IDXOUTFILE;
2324     }
2325   }
2326 }
2327
2328
2329
2330 #############################################################################
2331 ###  OTHER SETTINGS
2332 #############################################################################
2333
2334 # For split pages, use index.html as start page!
2335 if ($Texi2HTML::Config::SPLIT eq 'section' or
2336     $Texi2HTML::Config::SPLIT eq 'node') {
2337   $Texi2HTML::Config::TOP_FILE = 'index.html';
2338 }
2339
2340
2341 return 1;