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