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