]> git.donarmstrong.com Git - lilypond.git/blob - lilypond-texi2html.init
texi2html: Use a function ref to allow for variable number of params
[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 # Construct a href to an external source of information.
170 # node is the node with texinfo @-commands
171 # node_id is the node transliterated and transformed as explained in the
172 #         texinfo manual
173 # node_xhtml_id is the node transformed such that it is unique and can 
174 #     be used to make an html cross ref as explained in the texinfo manual
175 # file is the file in '(file)node'
176 sub lilypond_external_href($$$)
177 {
178     my $node = shift;
179     my $node_id = shift;
180     my $node_xhtml_id = shift;
181     my $file = shift;
182     my $original_func = \&t2h_default_external_href;
183     
184     # TODO: 
185     # 1) Keep a hash of book->section_map
186     # 2) if not file in keys hash => try to load the map (assign empty map is non-existent => will load only once!)
187     # 3) if node in the section=>(file, anchor) map, replace node_id and node_xhtml_id by the map's values
188     # 4) call the t2h_default_external_href with these values (or the old ones if not found)
189 print STDERR "lilypond_external_href: texi_node='$node', node_file='$node_id', node_xhtml_id='$node_xhtml_id', file='$file'\n\n";
190
191 #     $file = '' if (!defined($file));
192 #     my $default_target_split = $EXTERNAL_CROSSREF_SPLIT;
193 #     my $target_split;
194 #     my $target_mono;
195 #     my $href_split;
196 #     my $href_mono;
197 #     if ($file ne '')
198 #     {
199 #          if ($NEW_CROSSREF_STYLE)
200 #          {
201 #              $file =~ s/\.[^\.]*$//;
202 #              $file =~ s/^.*\///;
203 #              my $href;
204 #              if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}))
205 #              {
206 #                   if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'split'}))
207 #                   {
208 #                        $target_split = 1;
209 #                        $href_split =  $Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'split'}->{'href'};
210 #                   }
211 #                   if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'mono'}))
212 #                   {
213 #                        $target_mono = 1;
214 #                        $href_mono =  $Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'mono'}->{'href'};
215 #                   }
216 #              }
217
218 #              if ((not $target_mono) and (not $target_split))
219 #              { # nothing specified for that manual, use default
220 #                   $target_split = $default_target_split;
221 #              }
222 #              elsif ($target_split and $target_mono)
223 #              { # depends on the splitting of the manual
224 #                   $target_split = $SPLIT;
225 #              }
226 #              elsif ($target_mono)
227 #              { # only mono specified
228 #                   $target_split = 0;
229 #              }
230
231 #              if ($target_split)
232 #              {
233 #                   if (defined($href_split))
234 #                   {
235 #                        $file = "$href_split";
236 #                   }
237 #                   elsif (defined($EXTERNAL_DIR))
238 #                   {
239 #                        $file = "$EXTERNAL_DIR/$file";
240 #                   }
241 #                   elsif ($SPLIT)
242 #                   {
243 #                        $file = "../$file";
244 #                   }
245 #                   $file .= "/";
246 #              }
247 #              else
248 #              {# target not split
249 #                   if (defined($href_mono))
250 #                   {
251 #                        $file = "$href_mono";
252 #                   }
253 #                   else
254 #                   {
255 #                        if (defined($EXTERNAL_DIR))
256 #                        {
257 #                             $file = "$EXTERNAL_DIR/$file";
258 #                        }
259 #                        elsif ($SPLIT)
260 #                        {
261 #                            $file = "../$file";
262 #                        }
263 #                        $file .= "." . $NODE_FILE_EXTENSION;
264 #                   }
265 #              }
266 #          }
267 #          else
268 #          {
269 #              $file .= "/";
270 #              if (defined($EXTERNAL_DIR))
271 #              {
272 #                  $file = $EXTERNAL_DIR . $file;
273 #              }
274 #              else
275 #              {
276 #                  $file = '../' . $file;
277 #              } 
278 #          }
279 #     }
280 #     else
281 #     {
282 #         $target_split = $default_target_split;
283 #     }
284 #     if ($node eq '')
285 #     {
286 #          if ($NEW_CROSSREF_STYLE)
287 #          {
288 #              if ($target_split)
289 #              {
290 #                  return $file . $TOP_NODE_FILE . '.' . $NODE_FILE_EXTENSION . '#Top';
291 #                  # or ?
292 #                  #return $file . '#Top';
293 #              }
294 #              else
295 #              {
296 #                   return $file . '#Top';
297 #              }
298 #          }
299 #          else
300 #          {
301 #              return $file;
302 #          }
303 #     }
304 #     my $target;
305 #     if ($NEW_CROSSREF_STYLE)
306 #     {
307 #          $node = $node_id;
308 #          $target = $node_xhtml_id;
309 #     }
310 #     else
311 #     {
312 #          $node = main::remove_texi($node);
313 #          $node =~ s/[^\w\.\-]/-/g;
314 #     }
315 #     my $file_basename = $node;
316 #     $file_basename = $TOP_NODE_FILE if ($node =~ /^top$/i);
317 #     if ($NEW_CROSSREF_STYLE)
318 #     {
319 #         if ($target_split)
320 #         {
321 #             return $file . $file_basename . ".$NODE_FILE_EXTENSION" . '#' . $target;
322 #         }
323 #         else
324 #         {
325 #             return $file . '#' . $target;
326 #         }
327 #     }
328 #     else
329 #     {
330 #         return $file . $file_basename . ".$NODE_FILE_EXTENSION";
331 #     }
332   if (defined $file) {
333     return &$original_func($node, $node_id, $node_hxmlt_id, $file);
334   } else {
335     return &$original_func($node, $node_id, $node_hxmlt_id);
336   }
337 }
338
339
340
341 # recursively generate the TOC entries for the element and its children (which
342 # are only shown up to maxlevel. All ancestors of the current element are also 
343 # shown with their immediate children, irrespective of their level.
344 sub generate_ly_toc_entries($$$)
345 {
346   my $element = shift;
347   my $element_path = shift;
348   my $maxlevel = shift;
349   # Skip undefined sections, plus all sections generated by index splitting
350   return() if (not defined($element) or exists($element->{'index_page'}));
351   my @result = ();
352   my $level = $element->{'toc_level'};
353   my $is_parent_of_current = $element_path->{$element->{'number'}};
354   my $print_children = ( ($level < $maxlevel) or $is_parent_of_current );
355   my $ind = '  ' x $level;
356   my $this_css_class = $is_parent_of_current ? " class=\"toc_current\"" : "";
357
358   my $entry = "$ind<li$this_css_class>" . &$anchor ($element->{'tocid'}, "$element->{'file'}#$element->{'id'}",$element->{'text'});
359
360   my $children = $element->{'section_childs'};
361   if ( $print_children and defined($children) and (ref($children) eq "ARRAY") ) {
362     push (@result, $entry);
363     my @child_result = ();
364     foreach (@$children) {
365       push (@child_result, generate_ly_toc_entries($_, $element_path, $maxlevel));
366     }
367     # if no child nodes were generated, e.g. for the index, where expanded pages
368     # are ignored, don't generate a list at all...
369     if (@child_result) {
370       push (@result, "$ind<ul$NO_BULLET_LIST_ATTRIBUTE>");
371       push (@result, @child_result);
372       push (@result, "$ind</ul></li>\n");
373     }
374   } else {
375     push (@result, $entry . "</li>\n");
376   }
377   return @result;
378 }
379
380
381 # Print a customized TOC, containing only the first two levels plus the whole
382 # path to the current page
383 sub lilypond_generate_page_toc_body($)
384 {
385     my $element = shift;
386     my $current_element = $element;
387     my %parentelements;
388     $parentelements{$element->{'number'}} = 1;
389     # Find the path to the current element
390     while ( defined($current_element->{'sectionup'}) and 
391            ($current_element->{'sectionup'} ne $current_element) )
392     {
393       $parentelements{$current_element->{'sectionup'}->{'number'}} = 1
394               if ($current_element->{'sectionup'}->{'number'} ne '');
395       $current_element = $current_element->{'sectionup'};
396     }
397     return () if not defined($current_element);
398     # Create the toc entries recursively
399     my @toc_entries = ("<div class=\"contents\">", "<ul$NO_BULLET_LIST_ATTRIBUTE>");
400     my $children = $current_element->{'section_childs'};
401     foreach ( @$children ) {
402       push (@toc_entries, generate_ly_toc_entries($_, \%parentelements, $page_toc_depth));
403     }
404     push (@toc_entries, "</ul>");
405     push (@toc_entries, "</div>");
406     return @toc_entries;
407 }
408
409 my @this_page_toc = ();
410
411 sub lilypond_print_element_header
412 {
413   my $fh = shift;
414   my $first_in_page = shift;
415   my $previous_is_top = shift;
416   if ($first_in_page and not @this_page_toc) {
417     if (defined($Texi2HTML::THIS_ELEMENT)) {
418       # Create the TOC for this page
419       @this_page_toc = lilypond_generate_page_toc_body($Texi2HTML::THIS_ELEMENT);
420     }
421   }
422   return T2H_DEFAULT_print_element_header( $fh, $first_in_page, $previous_is_top);
423 }
424
425 sub lilypond_toc_body($)
426 {
427     my $elements_list = shift;
428     # Generate a default TOC for pages without THIS_ELEMENT
429     @default_toc = lilypond_generate_page_toc_body(@$elements_list[0]);
430     return T2H_GPL_toc_body($elements_list);
431 }
432
433
434 sub lilypond_css_lines ($$)
435 {
436     my $import_lines = shift;
437     my $rule_lines = shift;
438     return if (defined($CSS_LINES));
439 #     return if (!@$rule_lines and !@$import_lines and (! keys(%css_map)));
440     if (@$rule_lines or @$import_lines)
441     {
442         $CSS_LINES = "<style type=\"text/css\">\n<!--\n";
443         $CSS_LINES .= join('',@$import_lines) . "\n" if (@$import_lines);
444         $CSS_LINES .= join('',@$rule_lines) . "\n" if (@$rule_lines);
445         $CSS_LINES .= "-->\n</style>\n";
446     }
447     foreach my $ref (@CSS_REFS)
448     {
449         $CSS_LINES .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"$ref\">\n";
450     }
451     $CSS_LINES .= "<!--[if lte IE 7]>\n<link href=\"lilypond-ie-fixes.css\" rel=\"stylesheet\" type=\"text/css\">\n<![endif]-->\n";
452 }
453
454
455
456
457
458
459
460 # Print out the TOC in a <div> at the end of th page, which will be formatted as a
461 # sidebar mimicking a TOC frame
462 sub print_lilypond_page_foot($)
463 {
464   my $fh = shift;
465   my $program_string = &$program_string();
466   print $fh "<p><font size='-1'>$program_string</font><br>$PRE_BODY_CLOSE</p>\n";
467   
468   # Print the TOC frame:
469   my @lines = @this_page_toc;
470   # use default TOC if no custom lines have been generated
471   @lines = @default_toc if (not @lines);
472   if (@lines) {
473     print $fh "\n\n<div id=\"tocframe\">";
474     print $fh '<h4> ' . $Texi2HTML::NAME{'Contents'}  . "</h4>\n";
475     foreach my $line (@lines) {
476       print $fh $line;
477     }
478     print $fh "</div>";
479     @this_page_toc = ();
480   }
481   
482   # Close the page:
483   print $fh "</body>\n</html>\n";
484 }
485
486
487
488
489
490
491 sub get_navigation_text
492 {
493   my $button = shift;
494   my $text = $NAVIGATION_TEXT{$button};
495   if ( ($button eq 'Back') or ($button eq 'FastBack') ) {
496     $text = $text . $Texi2HTML::NODE{$button} . "&nbsp;";
497   } elsif ( ($button eq 'Forward') or ($button eq 'FastForward') ) {
498     $text = "&nbsp;" . $Texi2HTML::NODE{$button} . $text;
499   } elsif ( $button eq 'Up' ) {
500     $text = "&nbsp;".$text.":&nbsp;" . $Texi2HTML::NODE{$button} . "&nbsp;";
501   }
502   return $text;
503 }
504
505
506 # Don't automatically create left-aligned table cells for every link, but 
507 # instead create a <td> only on an appropriate '(left|right|center)-aligned-cell-n'
508 # button text. It's alignment as well as the colspan will be taken from the
509 # name of the button. Also, add 'newline' button text to create a new table
510 # row. The texts of the buttons are generated by get_navigation_text and 
511 # will contain the name of the next/previous section/chapter.
512 sub lilypond_print_navigation
513 {
514     my $fh = shift;
515     my $buttons = shift;
516     my $vertical = shift;
517     my $spacing = 1;
518 #     print $fh '<table cellpadding="', $spacing, '" cellspacing="', $spacing,
519 #       "\" border=\"0\" class=\"nav_table\">\n";
520     print $fh "<table class=\"nav_table\">\n";
521
522     print $fh "<tr>" unless $vertical;
523     my $beginofline = 1;
524     foreach my $button (@$buttons)
525     {
526         print $fh qq{<tr valign="top" align="left">\n} if $vertical;
527         # Allow (left|right|center)-aligned-cell and newline as buttons!
528         if ( $button =~ /^(.*)-aligned-cell-(.*)$/ ) 
529         {
530           print $fh qq{</td>} unless $beginofline;
531           print $fh qq{<td valign="middle" align="$1" colspan="$2">};
532           $beginofline = 0;
533         } 
534         elsif ( $button eq 'newline' ) 
535         {
536           print $fh qq{</td>} unless $beginofline;
537           print $fh qq{</tr>};
538           print $fh qq{<tr>};
539           $beginofline = 1;
540
541         } 
542         elsif (ref($button) eq 'CODE')
543         {
544             &$button($fh, $vertical);
545         }
546         elsif (ref($button) eq 'SCALAR')
547         {
548             print $fh "$$button" if defined($$button);
549         }
550         elsif (ref($button) eq 'ARRAY')
551         {
552             my $text = $button->[1];
553             my $button_href = $button->[0];
554             # verify that $button_href is simple text and text is a reference
555             if (defined($button_href) and !ref($button_href) 
556                and defined($text) and (ref($text) eq 'SCALAR') and defined($$text))
557             {             # use given text
558                 if ($Texi2HTML::HREF{$button_href})
559                 {
560                   my $anchor_attributes = '';
561                   if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button_href})) and ($BUTTONS_ACCESSKEY{$button_href} ne ''))
562                   {
563                       $anchor_attributes = "accesskey=\"$BUTTONS_ACCESSKEY{$button_href}\"";
564                   }
565                   if ($USE_REL_REV and (defined($BUTTONS_REL{$button_href})) and ($BUTTONS_REL{$button_href} ne ''))
566                   {
567                       $anchor_attributes .= " rel=\"$BUTTONS_REL{$button_href}\"";
568                   }
569                   print $fh "" .
570                         &$anchor('',
571                                     $Texi2HTML::HREF{$button_href},
572                                     get_navigation_text($$text),
573                                     $anchor_attributes
574                                    );
575                 }
576                 else
577                 {
578                   print $fh get_navigation_text($$text);
579                 }
580             }
581         }
582         elsif ($button eq ' ')
583         {                       # handle space button
584             print $fh
585                 ($ICONS && $ACTIVE_ICONS{' '}) ?
586                     &$button_icon_img($BUTTONS_NAME{$button}, $ACTIVE_ICONS{' '}) :
587                         $NAVIGATION_TEXT{' '};
588             #next;
589         }
590         elsif ($Texi2HTML::HREF{$button})
591         {                       # button is active
592             my $btitle = $BUTTONS_GOTO{$button} ?
593                 'title="' . $BUTTONS_GOTO{$button} . '"' : '';
594             if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button})) and ($BUTTONS_ACCESSKEY{$button} ne ''))
595             {
596                 $btitle .= " accesskey=\"$BUTTONS_ACCESSKEY{$button}\"";
597             }
598             if ($USE_REL_REV and (defined($BUTTONS_REL{$button})) and ($BUTTONS_REL{$button} ne ''))
599             {
600                 $btitle .= " rel=\"$BUTTONS_REL{$button}\"";
601             }
602             if ($ICONS && $ACTIVE_ICONS{$button})
603             {                   # use icon
604                 print $fh '' .
605                     &$anchor('',
606                         $Texi2HTML::HREF{$button},
607                         &$button_icon_img($BUTTONS_NAME{$button},
608                                    $ACTIVE_ICONS{$button},
609                                    $Texi2HTML::SIMPLE_TEXT{$button}),
610                         $btitle
611                       );
612             }
613             else
614             {                   # use text
615                 print $fh
616                     '[' .
617                         &$anchor('',
618                                     $Texi2HTML::HREF{$button},
619                                     get_navigation_text ($button),
620                                     $btitle
621                                    ) .
622                                        ']';
623             }
624         }
625         else
626         {                       # button is passive
627             print $fh
628                 $ICONS && $PASSIVE_ICONS{$button} ?
629                     &$button_icon_img($BUTTONS_NAME{$button},
630                                           $PASSIVE_ICONS{$button},
631                                           $Texi2HTML::SIMPLE_TEXT{$button}) :
632
633                                               "[" . get_navigation_text($button) . "]";
634         }
635         print $fh "</td>\n" if $vertical;
636         print $fh "</tr>\n" if $vertical;
637     }
638     print $fh "</td>" unless $beginofline;
639     print $fh "</tr>" unless $vertical;
640     print $fh "</table>\n";
641 }
642
643
644 @Texi2HTML::Config::SECTION_BUTTONS =
645     ('left-aligned-cell-1', 'FastBack', 
646      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
647      'right-aligned-cell-1', 'FastForward',
648      'newline',
649      'left-aligned-cell-2', 'Back',
650      'center-aligned-cell-1', 'Up',
651      'right-aligned-cell-2', 'Forward'
652     );
653
654 # buttons for misc stuff
655 @Texi2HTML::Config::MISC_BUTTONS = ('center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About');
656
657 # buttons for chapter file footers
658 # (and headers but only if SECTION_NAVIGATION is false)
659 @Texi2HTML::Config::CHAPTER_BUTTONS =
660     ('left-aligned-cell-1', 'FastBack', 
661      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
662      'right-aligned-cell-1', 'FastForward',
663     );
664
665 # buttons for section file footers
666 @Texi2HTML::Config::SECTION_FOOTER_BUTTONS =
667     ('left-aligned-cell-1', 'FastBack', 
668      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
669      'right-aligned-cell-1', 'FastForward',
670      'newline',
671      'left-aligned-cell-2', 'Back',
672      'center-aligned-cell-1', 'Up',
673      'right-aligned-cell-2', 'Forward'
674     );
675
676 @Texi2HTML::Config::NODE_FOOTER_BUTTONS =
677     ('left-aligned-cell-1', 'FastBack', 
678      'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
679      'right-aligned-cell-1', 'FastForward',
680      'newline',
681      'left-aligned-cell-2', 'Back',
682      'center-aligned-cell-1', 'Up',
683      'right-aligned-cell-2', 'Forward'
684     );
685
686
687
688 # For split pages, use index.html as start page!
689 if ($Texi2HTML::Config::SPLIT == 'section') {
690   $Texi2HTML::Config::TOP_FILE = 'index.html';
691 }
692
693
694
695 # Try to make use of @translationof to generate files according to the original
696 # English section title...
697 sub lilypond_unknown($$$$$)
698 {
699     my $macro = shift;
700     my $line = shift;
701     my $pass = shift;
702     my $stack = shift;
703     my $state = shift;
704
705     # the @translationof macro provides the original English section title, 
706     # which should be used for file/anchor naming, while the title will be
707     # translated to each language
708     if ($pass == 1 and $macro eq "translationof") {
709       if (ref($state->{'element'})=='HASH') {
710         $state->{'element'}->{'translationof'} = main::normalise_space($line);
711       }
712       return ('', true, undef, undef);
713     } else {
714       return t2h_default_unknown($macro, $line, $pass, $stack, $state);
715     }
716 }
717 $Texi2HTML::Config::unknown                  = \&lilypond_unknown;
718
719 %css_map=();
720
721 return 1;