]> git.donarmstrong.com Git - lilypond.git/blob - lilypond-texi2html.init
551cc15d5138d4154f323e47fc5e631780cbf65b
[lilypond.git] / lilypond-texi2html.init
1 #!/usr/bin/env perl
2
3 package Texi2HTML::Config;
4
5 use Data::Dumper;
6 $Data::Dumper::Maxdepth = 2;
7
8 @Texi2HTML::Config::CSS_REFS      = ("lilypond.css");
9 $Texi2HTML::Config::USE_ACCESSKEY = 1;
10 $Texi2HTML::Config::USE_LINKS     = 1;
11 $Texi2HTML::Config::USE_REL_REV   = 1;
12 $Texi2HTML::Config::element_file_name    = \&split_at_numbered_sections;
13 $Texi2HTML::Config::print_element_header = \&lilypond_print_element_header;
14 $Texi2HTML::Config::print_page_foot      = \&print_lilypond_page_foot;
15 $Texi2HTML::Config::print_navigation     = \&lilypond_print_navigation;
16 $Texi2HTML::Config::external_ref         = \&lilypond_external_ref;
17 $Texi2HTML::Config::external_href         = \&lilypond_external_href;
18 $Texi2HTML::Config::toc_body             = \&lilypond_toc_body;
19 $Texi2HTML::Config::css_lines            = \&lilypond_css_lines;
20 $Texi2HTML::Config::finish_out           = \&lilypond_finish_out;
21
22
23 my $lastfilename;
24 my $docnr = 0;
25 my $page_toc_depth = 2;
26 my @default_toc = [];
27 my @section_to_filename;
28
29
30 sub print_element_info($) 
31 {
32   my $element = shift;
33   print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
34   print "Element: $element\n";
35   print Dumper($element);
36 }
37
38
39 # Convert a given node name to its proper file name (normalization as explained
40 # in the texinfo manual:
41 # http://www.gnu.org/software/texinfo/manual/texinfo/html_node/HTML-Xref-Node-Name-Expansion.html
42 sub texinfo_file_name($)
43 {
44   my $str = shift;
45   # File name normalization by texinfo:
46   # 1/2: letters and numbers are left unchanged
47   # 3/4: multiple, leading and trailing whitespace is removed
48   $str = main::normalise_space($str);
49   # 5/6: all remaining spaces are converted to '-', all other 7- or 8-bit 
50   #      chars are replaced by _xxxx (xxxx=ascii character code)
51   my @chars = split(//, $str);
52   my $str = '';
53   foreach my $char (@chars) {
54     if ( $char eq ' ' ) { # space -> '-'
55       $str .= '-';
56     } elsif ( ('0' le $char and $char le '9' ) or
57               ('A' le $char and $char le 'Z' ) or
58               ('a' le $char and $char le 'z' ) ) { # number or letter
59       $str .= $char;
60     } else {
61       my $ccode = ord($char);
62       my $addstr;
63       if ( ord($char)<= 0xFFFF ) {
64         $addstr = sprintf("_%4x", $ccode);
65       } else {
66         $addstr = sprintf("__%6x", $ccode);
67       }
68       # padding is done by spaces, replace by '0'
69       $addstr =~ s/\ /0/g;
70       $str .= $addstr;
71     }
72   }
73   # 7: if name begins with number, prepend 't_g' (so it starts with a letter)
74   if ($str =~ /^[0-9]/) {
75     $str = 't_g' . $str;
76   }
77   # DONE
78   return $str
79 }
80
81
82
83 # This function makes sure that files are only generated for numbered sections,
84 # but not for unnumbered ones. It is called after texi2html has done its own
85 # splitting and simply returns the filename for the node given as first argument
86 # Nodes with the same filename will be printed out to the same filename, so 
87 # this really all we need. Also, make sure that the file names for sections
88 # are derived from the section title. We also might want to name the anchors
89 # according to node titles, which works by simply overriding the id element of 
90 # the $element hash.
91 sub split_at_numbered_sections($$$)
92 {
93   my $element = shift;
94   my $type = shift;
95   my $docu_name = shift;
96   my $docu_ext = $Texi2HTML::Config::EXTENSION;
97
98   # TOC, footer, about etc. are called with undefined $element and $type == "toc"|"stoc"|"foot"|"about"
99   if ($type eq "toc" or $type eq "stoc" or $type eq "foot" or $type eq "about") {
100     return;
101   } else {
102     # derive the name of the anchor (i.e. the part after # in the links!), 
103     # don't use texi2html's SECx.x default!
104     my $sec_name = main::remove_texi($$element{texi});
105     my $anchor = $sec_name;
106     if ($$element{translationof}) {
107       $anchor = main::remove_texi($$element{translationof});
108     }
109     # normalize to the same file name as texinfo
110     $anchor = texinfo_file_name($anchor);
111     $$element{id} = $anchor;
112     # Numbered sections will get a filename Section_1.1.2, unnumbered sections will use 
113     # the file name of the previous numbered section:
114     if ($$element{number}) {
115       my $filename = $anchor;
116       $filename .= ".$docu_ext" if (defined($docu_ext));
117       $docnr += 1;
118       $$element{doc_nr} = $docnr;
119       $lastfilename = $filename;
120       push (@section_to_filename, [$sec_name, $filename, $anchor]);
121       return $filename;
122     } else {
123       $$element{doc_nr} = $docnr;
124       push (@section_to_filename, [$sec_name, $lastfilename, $anchor]);
125       return $lastfilename;
126     }
127   }
128
129   return;
130 }
131
132 sub lilypond_finish_out()
133 {
134   my $map_filename = "$Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'file_base_name'}_xref.map";
135   if (open(XREFFILE, ">$map_filename")) {
136     foreach (@section_to_filename) {
137       my ($sec, $file, $anchor) = @$_;
138       print XREFFILE "$sec\t$file\t$anchor\n";
139     }
140     close XREFFILE;
141   } else {
142     print "Can't open $map_filename for writing: $! The map of X-refs will not be written out\n";
143   }
144 }
145
146
147
148 # The default formatting of external refs returns e.g. 
149 # "(lilypond-internals)Timing_translator", so we remove all (...) from the 
150 # file_and_node argument. Also, we want only a very simple format, so we don't
151 # even call the default handler!
152 sub lilypond_external_ref($$$$$$)
153 {
154   my $type = shift;
155   my $section = shift;
156   my $book = shift;
157   my $file_node = shift;
158   my $href = shift;
159   my $cross_ref = shift;
160
161   $file_node =~ s/\(.*\)//;
162   $file_node = &$anchor('', $href, $file_node) if ($file_node ne '');
163   return &$I('%{node_file_href}', { 'node_file_href' => $file_node });
164
165 #  Default: format as "see <a ..>NODE</a> section 'SECTION' in BOOK"
166 #   return t2h_default_external_ref($type, $section, $book, $file_node, $href, $cross_ref);
167 }
168
169
170 my %translated_books = ();
171 # Construct a href to an external source of information.
172 # node is the node with texinfo @-commands
173 # node_id is the node transliterated and transformed as explained in the
174 #         texinfo manual
175 # node_xhtml_id is the node transformed such that it is unique and can 
176 #     be used to make an html cross ref as explained in the texinfo manual
177 # file is the file in '(file)node'
178 sub lilypond_external_href($$$)
179 {
180   my $node = shift;
181   my $node_id = shift;
182   my $node_xhtml_id = shift;
183   my $file = shift;
184   my $original_func = \&t2h_default_external_href;
185
186   # TODO:
187   # 1) Keep a hash of book->section_map
188   # 2) if not file in keys hash => try to load the map (assign empty map is non-existent => will load only once!)
189   # 3) if node in the section=>(file, anchor) map, replace node_id and node_xhtml_id by the map's values
190   # 4) call the t2h_default_external_href with these values (or the old ones if not found)
191   print STDERR "lilypond_external_href: texi_node='$node', node_file='$node_id', node_xhtml_id='$node_xhtml_id', file='$file'\n";
192   if (($node_id ne '') and defined($file)) {
193     if (!exists($translated_books{$file})) {
194       print STDERR "Map for book $file not yet loaded, trying to initialize\n";
195       # TODO: Load the file...
196       $translated_books{$file}={};
197     }
198     my $section_name_map = $translated_books{$file};
199     if (exists($section_name_map->{$node_id})) {
200       print STDERR "Found key $node_id in section_name_map\n";
201       # TODO: Assign the new values to $file, $node_id and $node_xhtml_id!
202     } else {
203       print STDERR "Unable to find key $node_id in section_name_map\n";
204     }
205   }
206   print STDERR "\n";
207 #
208 #     $file = '' if (!defined($file));
209 #     my $default_target_split = $EXTERNAL_CROSSREF_SPLIT;
210 #     my $target_split;
211 #     my $target_mono;
212 #     my $href_split;
213 #     my $href_mono;
214 #     if ($file ne '')
215 #     {
216 #          if ($NEW_CROSSREF_STYLE)
217 #          {
218 #              $file =~ s/\.[^\.]*$//;
219 #              $file =~ s/^.*\///;
220 #              my $href;
221 #              if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}))
222 #              {
223 #                   if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'split'}))
224 #                   {
225 #                        $target_split = 1;
226 #                        $href_split =  $Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'split'}->{'href'};
227 #                   }
228 #                   if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'mono'}))
229 #                   {
230 #                        $target_mono = 1;
231 #                        $href_mono =  $Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'mono'}->{'href'};
232 #                   }
233 #              }
234
235 #              if ((not $target_mono) and (not $target_split))
236 #              { # nothing specified for that manual, use default
237 #                   $target_split = $default_target_split;
238 #              }
239 #              elsif ($target_split and $target_mono)
240 #              { # depends on the splitting of the manual
241 #                   $target_split = $SPLIT;
242 #              }
243 #              elsif ($target_mono)
244 #              { # only mono specified
245 #                   $target_split = 0;
246 #              }
247
248 #              if ($target_split)
249 #              {
250 #                   if (defined($href_split))
251 #                   {
252 #                        $file = "$href_split";
253 #                   }
254 #                   elsif (defined($EXTERNAL_DIR))
255 #                   {
256 #                        $file = "$EXTERNAL_DIR/$file";
257 #                   }
258 #                   elsif ($SPLIT)
259 #                   {
260 #                        $file = "../$file";
261 #                   }
262 #                   $file .= "/";
263 #              }
264 #              else
265 #              {# target not split
266 #                   if (defined($href_mono))
267 #                   {
268 #                        $file = "$href_mono";
269 #                   }
270 #                   else
271 #                   {
272 #                        if (defined($EXTERNAL_DIR))
273 #                        {
274 #                             $file = "$EXTERNAL_DIR/$file";
275 #                        }
276 #                        elsif ($SPLIT)
277 #                        {
278 #                            $file = "../$file";
279 #                        }
280 #                        $file .= "." . $NODE_FILE_EXTENSION;
281 #                   }
282 #              }
283 #          }
284 #          else
285 #          {
286 #              $file .= "/";
287 #              if (defined($EXTERNAL_DIR))
288 #              {
289 #                  $file = $EXTERNAL_DIR . $file;
290 #              }
291 #              else
292 #              {
293 #                  $file = '../' . $file;
294 #              } 
295 #          }
296 #     }
297 #     else
298 #     {
299 #         $target_split = $default_target_split;
300 #     }
301 #     if ($node eq '')
302 #     {
303 #          if ($NEW_CROSSREF_STYLE)
304 #          {
305 #              if ($target_split)
306 #              {
307 #                  return $file . $TOP_NODE_FILE . '.' . $NODE_FILE_EXTENSION . '#Top';
308 #                  # or ?
309 #                  #return $file . '#Top';
310 #              }
311 #              else
312 #              {
313 #                   return $file . '#Top';
314 #              }
315 #          }
316 #          else
317 #          {
318 #              return $file;
319 #          }
320 #     }
321 #     my $target;
322 #     if ($NEW_CROSSREF_STYLE)
323 #     {
324 #          $node = $node_id;
325 #          $target = $node_xhtml_id;
326 #     }
327 #     else
328 #     {
329 #          $node = main::remove_texi($node);
330 #          $node =~ s/[^\w\.\-]/-/g;
331 #     }
332 #     my $file_basename = $node;
333 #     $file_basename = $TOP_NODE_FILE if ($node =~ /^top$/i);
334 #     if ($NEW_CROSSREF_STYLE)
335 #     {
336 #         if ($target_split)
337 #         {
338 #             return $file . $file_basename . ".$NODE_FILE_EXTENSION" . '#' . $target;
339 #         }
340 #         else
341 #         {
342 #             return $file . '#' . $target;
343 #         }
344 #     }
345 #     else
346 #     {
347 #         return $file . $file_basename . ".$NODE_FILE_EXTENSION";
348 #     }
349   if (defined $file) {
350     return &$original_func($node, $node_id, $node_hxmlt_id, $file);
351   } else {
352     return &$original_func($node, $node_id, $node_hxmlt_id);
353   }
354 }
355
356
357
358 # recursively generate the TOC entries for the element and its children (which
359 # are only shown up to maxlevel. All ancestors of the current element are also 
360 # shown with their immediate children, irrespective of their level.
361 sub generate_ly_toc_entries($$$)
362 {
363   my $element = shift;
364   my $element_path = shift;
365   my $maxlevel = shift;
366   # Skip undefined sections, plus all sections generated by index splitting
367   return() if (not defined($element) or exists($element->{'index_page'}));
368   my @result = ();
369   my $level = $element->{'toc_level'};
370   my $is_parent_of_current = $element_path->{$element->{'number'}};
371   my $print_children = ( ($level < $maxlevel) or $is_parent_of_current );
372   my $ind = '  ' x $level;
373   my $this_css_class = $is_parent_of_current ? " class=\"toc_current\"" : "";
374
375   my $entry = "$ind<li$this_css_class>" . &$anchor ($element->{'tocid'}, "$element->{'file'}#$element->{'id'}",$element->{'text'});
376
377   my $children = $element->{'section_childs'};
378   if ( $print_children and defined($children) and (ref($children) eq "ARRAY") ) {
379     push (@result, $entry);
380     my @child_result = ();
381     foreach (@$children) {
382       push (@child_result, generate_ly_toc_entries($_, $element_path, $maxlevel));
383     }
384     # if no child nodes were generated, e.g. for the index, where expanded pages
385     # are ignored, don't generate a list at all...
386     if (@child_result) {
387       push (@result, "$ind<ul$NO_BULLET_LIST_ATTRIBUTE>");
388       push (@result, @child_result);
389       push (@result, "$ind</ul></li>\n");
390     }
391   } else {
392     push (@result, $entry . "</li>\n");
393   }
394   return @result;
395 }
396
397
398 # Print a customized TOC, containing only the first two levels plus the whole
399 # path to the current page
400 sub lilypond_generate_page_toc_body($)
401 {
402     my $element = shift;
403     my $current_element = $element;
404     my %parentelements;
405     $parentelements{$element->{'number'}} = 1;
406     # Find the path to the current element
407     while ( defined($current_element->{'sectionup'}) and 
408            ($current_element->{'sectionup'} ne $current_element) )
409     {
410       $parentelements{$current_element->{'sectionup'}->{'number'}} = 1
411               if ($current_element->{'sectionup'}->{'number'} ne '');
412       $current_element = $current_element->{'sectionup'};
413     }
414     return () if not defined($current_element);
415     # Create the toc entries recursively
416     my @toc_entries = ("<div class=\"contents\">", "<ul$NO_BULLET_LIST_ATTRIBUTE>");
417     my $children = $current_element->{'section_childs'};
418     foreach ( @$children ) {
419       push (@toc_entries, generate_ly_toc_entries($_, \%parentelements, $page_toc_depth));
420     }
421     push (@toc_entries, "</ul>");
422     push (@toc_entries, "</div>");
423     return @toc_entries;
424 }
425
426 my @this_page_toc = ();
427
428 sub lilypond_print_element_header
429 {
430   my $fh = shift;
431   my $first_in_page = shift;
432   my $previous_is_top = shift;
433   if ($first_in_page and not @this_page_toc) {
434     if (defined($Texi2HTML::THIS_ELEMENT)) {
435       # Create the TOC for this page
436       @this_page_toc = lilypond_generate_page_toc_body($Texi2HTML::THIS_ELEMENT);
437     }
438   }
439   return T2H_DEFAULT_print_element_header( $fh, $first_in_page, $previous_is_top);
440 }
441
442 sub lilypond_toc_body($)
443 {
444     my $elements_list = shift;
445     # Generate a default TOC for pages without THIS_ELEMENT
446     @default_toc = lilypond_generate_page_toc_body(@$elements_list[0]);
447     return T2H_GPL_toc_body($elements_list);
448 }
449
450
451 sub lilypond_css_lines ($$)
452 {
453     my $import_lines = shift;
454     my $rule_lines = shift;
455     return if (defined($CSS_LINES));
456 #     return if (!@$rule_lines and !@$import_lines and (! keys(%css_map)));
457     if (@$rule_lines or @$import_lines)
458     {
459         $CSS_LINES = "<style type=\"text/css\">\n<!--\n";
460         $CSS_LINES .= join('',@$import_lines) . "\n" if (@$import_lines);
461         $CSS_LINES .= join('',@$rule_lines) . "\n" if (@$rule_lines);
462         $CSS_LINES .= "-->\n</style>\n";
463     }
464     foreach my $ref (@CSS_REFS)
465     {
466         $CSS_LINES .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"$ref\">\n";
467     }
468     $CSS_LINES .= "<!--[if lte IE 7]>\n<link href=\"lilypond-ie-fixes.css\" rel=\"stylesheet\" type=\"text/css\">\n<![endif]-->\n";
469 }
470
471
472
473
474
475
476
477 # Print out the TOC in a <div> at the end of th page, which will be formatted as a
478 # sidebar mimicking a TOC frame
479 sub print_lilypond_page_foot($)
480 {
481   my $fh = shift;
482   my $program_string = &$program_string();
483   print $fh "<p><font size='-1'>$program_string</font><br>$PRE_BODY_CLOSE</p>\n";
484   
485   # Print the TOC frame:
486   my @lines = @this_page_toc;
487   # use default TOC if no custom lines have been generated
488   @lines = @default_toc if (not @lines);
489   if (@lines) {
490     print $fh "\n\n<div id=\"tocframe\">";
491     print $fh '<h4> ' . $Texi2HTML::NAME{'Contents'}  . "</h4>\n";
492     foreach my $line (@lines) {
493       print $fh $line;
494     }
495     print $fh "</div>";
496     @this_page_toc = ();
497   }
498   
499   # Close the page:
500   print $fh "</body>\n</html>\n";
501 }
502
503
504
505
506
507
508 sub get_navigation_text
509 {
510   my $button = shift;
511   my $text = $NAVIGATION_TEXT{$button};
512   if ( ($button eq 'Back') or ($button eq 'FastBack') ) {
513     $text = $text . $Texi2HTML::NODE{$button} . "&nbsp;";
514   } elsif ( ($button eq 'Forward') or ($button eq 'FastForward') ) {
515     $text = "&nbsp;" . $Texi2HTML::NODE{$button} . $text;
516   } elsif ( $button eq 'Up' ) {
517     $text = "&nbsp;".$text.":&nbsp;" . $Texi2HTML::NODE{$button} . "&nbsp;";
518   }
519   return $text;
520 }
521
522
523 # Don't automatically create left-aligned table cells for every link, but 
524 # instead create a <td> only on an appropriate '(left|right|center)-aligned-cell-n'
525 # button text. It's alignment as well as the colspan will be taken from the
526 # name of the button. Also, add 'newline' button text to create a new table
527 # row. The texts of the buttons are generated by get_navigation_text and 
528 # will contain the name of the next/previous section/chapter.
529 sub lilypond_print_navigation
530 {
531     my $fh = shift;
532     my $buttons = shift;
533     my $vertical = shift;
534     my $spacing = 1;
535 #     print $fh '<table cellpadding="', $spacing, '" cellspacing="', $spacing,
536 #       "\" border=\"0\" class=\"nav_table\">\n";
537     print $fh "<table class=\"nav_table\">\n";
538
539     print $fh "<tr>" unless $vertical;
540     my $beginofline = 1;
541     foreach my $button (@$buttons)
542     {
543         print $fh qq{<tr valign="top" align="left">\n} if $vertical;
544         # Allow (left|right|center)-aligned-cell and newline as buttons!
545         if ( $button =~ /^(.*)-aligned-cell-(.*)$/ ) 
546         {
547           print $fh qq{</td>} unless $beginofline;
548           print $fh qq{<td valign="middle" align="$1" colspan="$2">};
549           $beginofline = 0;
550         } 
551         elsif ( $button eq 'newline' ) 
552         {
553           print $fh qq{</td>} unless $beginofline;
554           print $fh qq{</tr>};
555           print $fh qq{<tr>};
556           $beginofline = 1;
557
558         } 
559         elsif (ref($button) eq 'CODE')
560         {
561             &$button($fh, $vertical);
562         }
563         elsif (ref($button) eq 'SCALAR')
564         {
565             print $fh "$$button" if defined($$button);
566         }
567         elsif (ref($button) eq 'ARRAY')
568         {
569             my $text = $button->[1];
570             my $button_href = $button->[0];
571             # verify that $button_href is simple text and text is a reference
572             if (defined($button_href) and !ref($button_href) 
573                and defined($text) and (ref($text) eq 'SCALAR') and defined($$text))
574             {             # use given text
575                 if ($Texi2HTML::HREF{$button_href})
576                 {
577                   my $anchor_attributes = '';
578                   if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button_href})) and ($BUTTONS_ACCESSKEY{$button_href} ne ''))
579                   {
580                       $anchor_attributes = "accesskey=\"$BUTTONS_ACCESSKEY{$button_href}\"";
581                   }
582                   if ($USE_REL_REV and (defined($BUTTONS_REL{$button_href})) and ($BUTTONS_REL{$button_href} ne ''))
583                   {
584                       $anchor_attributes .= " rel=\"$BUTTONS_REL{$button_href}\"";
585                   }
586                   print $fh "" .
587                         &$anchor('',
588                                     $Texi2HTML::HREF{$button_href},
589                                     get_navigation_text($$text),
590                                     $anchor_attributes
591                                    );
592                 }
593                 else
594                 {
595                   print $fh get_navigation_text($$text);
596                 }
597             }
598         }
599         elsif ($button eq ' ')
600         {                       # handle space button
601             print $fh
602                 ($ICONS && $ACTIVE_ICONS{' '}) ?
603                     &$button_icon_img($BUTTONS_NAME{$button}, $ACTIVE_ICONS{' '}) :
604                         $NAVIGATION_TEXT{' '};
605             #next;
606         }
607         elsif ($Texi2HTML::HREF{$button})
608         {                       # button is active
609             my $btitle = $BUTTONS_GOTO{$button} ?
610                 'title="' . $BUTTONS_GOTO{$button} . '"' : '';
611             if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button})) and ($BUTTONS_ACCESSKEY{$button} ne ''))
612             {
613                 $btitle .= " accesskey=\"$BUTTONS_ACCESSKEY{$button}\"";
614             }
615             if ($USE_REL_REV and (defined($BUTTONS_REL{$button})) and ($BUTTONS_REL{$button} ne ''))
616             {
617                 $btitle .= " rel=\"$BUTTONS_REL{$button}\"";
618             }
619             if ($ICONS && $ACTIVE_ICONS{$button})
620             {                   # use icon
621                 print $fh '' .
622                     &$anchor('',
623                         $Texi2HTML::HREF{$button},
624                         &$button_icon_img($BUTTONS_NAME{$button},
625                                    $ACTIVE_ICONS{$button},
626                                    $Texi2HTML::SIMPLE_TEXT{$button}),
627                         $btitle
628                       );
629             }
630             else
631             {                   # use text
632                 print $fh
633                     '[' .
634                         &$anchor('',
635                                     $Texi2HTML::HREF{$button},
636                                     get_navigation_text ($button),
637                                     $btitle
638                                    ) .
639                                        ']';
640             }
641         }
642         else
643         {                       # button is passive
644             print $fh
645                 $ICONS && $PASSIVE_ICONS{$button} ?
646                     &$button_icon_img($BUTTONS_NAME{$button},
647                                           $PASSIVE_ICONS{$button},
648                                           $Texi2HTML::SIMPLE_TEXT{$button}) :
649
650                                               "[" . get_navigation_text($button) . "]";
651         }
652         print $fh "</td>\n" if $vertical;
653         print $fh "</tr>\n" if $vertical;
654     }
655     print $fh "</td>" unless $beginofline;
656     print $fh "</tr>" unless $vertical;
657     print $fh "</table>\n";
658 }
659
660
661 @Texi2HTML::Config::SECTION_BUTTONS =
662     ('left-aligned-cell-1', 'FastBack', 
663      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
664      'right-aligned-cell-1', 'FastForward',
665      'newline',
666      'left-aligned-cell-2', 'Back',
667      'center-aligned-cell-1', 'Up',
668      'right-aligned-cell-2', 'Forward'
669     );
670
671 # buttons for misc stuff
672 @Texi2HTML::Config::MISC_BUTTONS = ('center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About');
673
674 # buttons for chapter file footers
675 # (and headers but only if SECTION_NAVIGATION is false)
676 @Texi2HTML::Config::CHAPTER_BUTTONS =
677     ('left-aligned-cell-1', 'FastBack', 
678      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
679      'right-aligned-cell-1', 'FastForward',
680     );
681
682 # buttons for section file footers
683 @Texi2HTML::Config::SECTION_FOOTER_BUTTONS =
684     ('left-aligned-cell-1', 'FastBack', 
685      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
686      'right-aligned-cell-1', 'FastForward',
687      'newline',
688      'left-aligned-cell-2', 'Back',
689      'center-aligned-cell-1', 'Up',
690      'right-aligned-cell-2', 'Forward'
691     );
692
693 @Texi2HTML::Config::NODE_FOOTER_BUTTONS =
694     ('left-aligned-cell-1', 'FastBack', 
695      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
696      'right-aligned-cell-1', 'FastForward',
697      'newline',
698      'left-aligned-cell-2', 'Back',
699      'center-aligned-cell-1', 'Up',
700      'right-aligned-cell-2', 'Forward'
701     );
702
703
704
705 # For split pages, use index.html as start page!
706 if ($Texi2HTML::Config::SPLIT == 'section') {
707   $Texi2HTML::Config::TOP_FILE = 'index.html';
708 }
709
710
711
712 # Try to make use of @translationof to generate files according to the original
713 # English section title...
714 sub lilypond_unknown($$$$$)
715 {
716     my $macro = shift;
717     my $line = shift;
718     my $pass = shift;
719     my $stack = shift;
720     my $state = shift;
721
722     # the @translationof macro provides the original English section title, 
723     # which should be used for file/anchor naming, while the title will be
724     # translated to each language
725     if ($pass == 1 and $macro eq "translationof") {
726       if (ref($state->{'element'})=='HASH') {
727         $state->{'element'}->{'translationof'} = main::normalise_space($line);
728       }
729       return ('', true, undef, undef);
730     } else {
731       return t2h_default_unknown($macro, $line, $pass, $stack, $state);
732     }
733 }
734 $Texi2HTML::Config::unknown                  = \&lilypond_unknown;
735
736 %css_map=();
737
738 return 1;