3 ### texi2html customization script for Lilypond
4 ### Author: Reinhold Kainhofer <reinhold@kainhofer.com>, 2008.
5 ### Some code parts copied from texi2html and adapted.
9 ### Features implemented here:
10 ### -) For split manuals, the main page is index.html.
11 ### -) All @unnumbered* sections are placed into the same file
12 ### (implemented by split_at_numbered_sections)
13 ### -) Use our custom CSS file, with IE-specific fixes in another CSS file,
14 ### impelmented by lilypond_css_lines
15 ### -) TOC (folded, with the current page highlighted) in an iframe is added
16 ### to every page; implemented by:
17 ### lilypond_print_element_header -- building of the TOC
18 ### lilypond_toc_body -- generation of customized TOC output
19 ### lilypond_print_page_head -- start <div id="main">
20 ### print_lilypond_page_foot -- closing id=main, output of footer & TOC
21 ### -) External refs are formatted only as "Text of the node" (not as >>see
22 ### "NODE" section "SECTION" in "BOOK"<< like with default texi2html). Also,
23 ### the leading "(book-name)" is removed.
24 ### Implemented by overriding lilypond_external_ref
25 ### -) Navigation bars on top/bottom of the page and between sections are not
26 ### left-aligned, but use a combination of left/center/right aligned table
27 ### cells; For this, I heavily extend the texi2html code to allow for
28 ### differently aligned cells and for multi-line tables);
29 ### Implemented in lilypond_print_navigation
30 ### -) Allow translated section titles: All section titles can be translated,
31 ### the original (English) title is associated with @translationof. This is
32 ### needed, because the file name / anchor is generated from the original
33 ### English title, since otherwise language-autoselection would break with
35 ### Since it is then no longer possible to obtain the file name from the
36 ### section title, I keep a sectionname<=>filename/anchor around. This way,
37 ### xrefs from other manuals can simply load that map and retrieve the
38 ### correct file name for the link. Implemented in:
39 ### lilypond_unknown (handling of @translationof, in case
40 ### extract_texi_filenames.py messes up...)
41 ### split_at_numbered_sections (correct file name: use the map)
42 ### lilypond_init_out (read in the externally created map from disk)
43 ### lilypond_external_href (load the map for xrefs, use the correct
47 ### Useful helper functions:
48 ### -) texinfo_file_name($node_name): returns a texinfo-compatible file name
49 ### for the given string $node_name (whitespace trimmed/replaced by -,
50 ### non-standard chars replaced by _xxxx (ascii char code) and forced to
51 ### start with a letter by prepending t_g if necessary)
54 package Texi2HTML::Config;
60 #############################################################################
61 ### SETTINGS FOR TEXI2HTML
62 #############################################################################
64 @Texi2HTML::Config::CSS_REFS = ("lilypond.css");
65 $Texi2HTML::Config::USE_ACCESSKEY = 1;
66 $Texi2HTML::Config::USE_LINKS = 1;
67 $Texi2HTML::Config::USE_REL_REV = 1;
68 $Texi2HTML::Config::element_file_name = \&split_at_numbered_sections;
69 $Texi2HTML::Config::print_element_header = \&lilypond_print_element_header;
70 $Texi2HTML::Config::print_page_foot = \&print_lilypond_page_foot;
71 $Texi2HTML::Config::print_navigation = \&lilypond_print_navigation;
72 $Texi2HTML::Config::external_ref = \&lilypond_external_ref;
73 $Texi2HTML::Config::external_href = \&lilypond_external_href;
74 $Texi2HTML::Config::toc_body = \&lilypond_toc_body;
75 $Texi2HTML::Config::css_lines = \&lilypond_css_lines;
76 $Texi2HTML::Config::init_out = \&lilypond_init_out;
77 $Texi2HTML::Config::unknown = \&lilypond_unknown;
78 $Texi2HTML::Config::print_page_head = \&lilypond_print_page_head;
81 my @section_to_filename;
86 #############################################################################
88 #############################################################################
91 $Data::Dumper::Maxdepth = 2;
93 sub print_element_info($)
96 print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
97 print "Element: $element\n";
98 print Dumper($element);
105 #############################################################################
107 #############################################################################
109 # Convert a given node name to its proper file name (normalization as explained
110 # in the texinfo manual:
111 # http://www.gnu.org/software/texinfo/manual/texinfo/html_node/HTML-Xref-Node-Name-Expansion.html
112 sub texinfo_file_name($)
116 # File name normalization by texinfo:
117 # 1/2: letters and numbers are left unchanged
118 # 3/4: multiple, leading and trailing whitespace is removed
119 $text = main::normalise_space($text);
120 # 5/6: all remaining spaces are converted to '-', all other 7- or 8-bit
121 # chars are replaced by _xxxx (xxxx=ascii character code)
122 while ($text ne '') {
123 if ($text =~ s/^([A-Za-z0-9]+)//o) { # number or letter stay unchanged
125 } elsif ($text =~ s/^ //o) { # space -> '-'
127 } elsif ($text =~ s/^(.)//o) { # Otherwise use _xxxx (ascii char code)
129 if ( $ccode <= 0xFFFF ) {
130 $result .= sprintf("_%04x", $ccode);
132 $result .= sprintf("__%06x", $ccode);
136 # 7: if name does not begin with a letter, prepend 't_g' (so it starts with a letter)
137 if ($result !~ /^[a-zA-Z]/) {
138 $result = 't_g' . $result;
145 # Load a file containing a nodename<=>filename map (tab-sepatared, i.e.
146 # NODENAME\tFILENAME\tANCHOR
147 # Returns a ref to a hash "Node title" => ["FilenameWithoutExt", "Anchor"]
148 sub load_map_file ($)
152 # TODO: Load and parse the file
154 if (open(XREFFILE, $mapfilename)) {
155 @nodelist = <XREFFILE>;
157 # parse the tab-separated entries and insert them into the map:
158 foreach $node (@nodelist) {
160 my @entries = split(/\t/, $node);
161 if (length (@entries) == 3) {
162 $node_map->{$entries[0]} = [$entries[1], $entries[2]];
164 print STDERR "Invalid entry in the node file $mapfile: $node\n";
168 print STDERR "Unable to load the map file $mapfile\n";
177 #############################################################################
179 #############################################################################
181 # Include our standard CSS file, not hard-coded CSS code directly in the HTML!
182 # For IE, conditionally include the lilypond-ie-fixes.css style sheet
183 sub lilypond_css_lines ($$)
185 my $import_lines = shift;
186 my $rule_lines = shift;
187 return if (defined($CSS_LINES));
188 if (@$rule_lines or @$import_lines)
190 $CSS_LINES = "<style type=\"text/css\">\n<!--\n";
191 $CSS_LINES .= join('',@$import_lines) . "\n" if (@$import_lines);
192 $CSS_LINES .= join('',@$rule_lines) . "\n" if (@$rule_lines);
193 $CSS_LINES .= "-->\n</style>\n";
195 foreach my $ref (@CSS_REFS)
197 $CSS_LINES .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"$ref\">\n";
199 $CSS_LINES .= "<!--[if lte IE 7]>\n<link href=\"lilypond-ie-fixes.css\" rel=\"stylesheet\" type=\"text/css\">\n<![endif]-->\n";
206 #############################################################################
207 ### SPLITTING BASED ON NUMBERED SECTIONS
208 #############################################################################
212 my $node_to_filename_map = ();
214 # This function makes sure that files are only generated for numbered sections,
215 # but not for unnumbered ones. It is called after texi2html has done its own
216 # splitting and simply returns the filename for the node given as first argument
217 # Nodes with the same filename will be printed out to the same filename, so
218 # this really all we need. Also, make sure that the file names for sections
219 # are derived from the section title. We also might want to name the anchors
220 # according to node titles, which works by simply overriding the id element of
222 # If an external nodename<=>filename/anchor map file is found (loaded in
223 # lilypond_init_out, use the externally created values, otherwise use the
225 sub split_at_numbered_sections($$$)
229 my $docu_name = shift;
230 my $docu_ext = $Texi2HTML::Config::EXTENSION;
232 my $node_name = $element->{'node_ref'}->{'no_texi'};
233 if (exists ($node_to_filename_map->{$node_name})) {
234 (my $filename, my $anchor) = @$node_to_filename_map->{$node_name};
235 $filename .= ".$docu_ext" if (defined($docu_ext));
236 # TODO: Does this work?
237 print "Stored target: " + $node_to_filename_map->{$node_name};
238 $element->{id} = $anchor;
239 if ($filename == $lastfilename) {
240 $$element{doc_nr} = $docnr;
243 $$element{doc_nr} = $docnr;
244 $lastfilename = $filename;
248 } elsif ($type eq "top" or $type eq "toc" or $type eq "doc" or $type eq "stoc" or $type eq "foot" or $type eq "about") {
249 # TOC, footer, about etc. are called with undefined $element and $type == "toc"|"stoc"|"foot"|"about"
252 # If we have an entry in the section<=>filename map, use that one, otherwise
253 # generate the filename/anchor here. In the latter case, external manuals
254 # will not be able to retrieve the file name for xrefs!!! Still, I already
255 # had that code, so I'll leave it in in case something goes wrong with the
256 #extract_texi_filenames.py script in the lilypond build process!
257 # TODO: lookup node name in nodename<=>filename map
259 # derive the name of the anchor (i.e. the part after # in the links!),
260 # don't use texi2html's SECx.x default!
262 my $sec_name = main::remove_texi($element->{'texi'});
263 if ($element->{'node_ref'}->{'texi'} ne '') { # if we have a node, use its name:
264 $sec_name = main::remove_texi($element->{'node_ref'}->{'texi'});
266 my $anchor = $sec_name;
267 if ($$element{translationof}) {
268 $anchor = main::remove_texi($$element{translationof});
270 # normalize to the same file name as texinfo
271 $anchor = texinfo_file_name($anchor);
272 $$element{id} = $anchor;
273 # Numbered sections will get a filename Node_title, unnumbered sections will use
274 # the file name of the previous numbered section:
275 if (($element->{number}) or ($lastfilename eq '') or ($element->{level} == 1)) {
276 my $filename = $anchor;
277 $filename .= ".$docu_ext" if (defined($docu_ext));
279 $$element{doc_nr} = $docnr;
280 $lastfilename = $filename;
283 $$element{doc_nr} = $docnr;
284 return $lastfilename;
291 sub lilypond_init_out ()
293 t2h_default_init_out ();
294 # TODO: find correct path to the map file
295 # my $map_filename = "$Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'file_base_name'}_xref.map";
296 my $map_filename = "$Texi2HTML::THISDOC{'file_base_name'}_xref.map";
297 $node_to_filename_map = load_map_file ($map_filename);
301 #############################################################################
302 ### CLEANER LINK TITLE FOR EXTERNAL REFS
303 #############################################################################
305 # The default formatting of external refs returns e.g.
306 # "(lilypond-internals)Timing_translator", so we remove all (...) from the
307 # file_and_node argument. Also, we want only a very simple format, so we don't
308 # even call the default handler!
309 sub lilypond_external_ref($$$$$$)
314 my $file_node = shift;
316 my $cross_ref = shift;
318 $file_node =~ s/\(.*\)//;
319 $file_node = &$anchor('', $href, $file_node) if ($file_node ne '');
320 return &$I('%{node_file_href}', { 'node_file_href' => $file_node });
322 # Default: format as "see <a ..>NODE</a> section 'SECTION' in BOOK". We don't want this!
323 # return t2h_default_external_ref($type, $section, $book, $file_node, $href, $cross_ref);
330 #############################################################################
331 ### HANDLING TRANSLATED SECTIONS: handle @translationof, secname<->filename
332 ### map stored on disk, xrefs in other manuals load that map
333 #############################################################################
336 # Try to make use of @translationof to generate files according to the original
337 # English section title...
338 sub lilypond_unknown($$$$$)
346 # the @translationof macro provides the original English section title,
347 # which should be used for file/anchor naming, while the title will be
348 # translated to each language
349 # It is already used by extract_texi_filenames.py, so this should not be
350 # necessary here at all. Still, I'll leave the code in just in case the
351 # python script messed up ;-)
352 if ($pass == 1 and $macro eq "translationof") {
353 if (ref($state->{'element'})=='HASH') {
354 $state->{'element'}->{'translationof'} = main::normalise_space($line);
356 return ('', true, undef, undef);
358 return t2h_default_unknown($macro, $line, $pass, $stack, $state);
365 my %translated_books = ();
366 # Construct a href to an external source of information.
367 # node is the node with texinfo @-commands
368 # node_id is the node transliterated and transformed as explained in the
370 # node_xhtml_id is the node transformed such that it is unique and can
371 # be used to make an html cross ref as explained in the texinfo manual
372 # file is the file in '(file)node'
373 sub lilypond_external_href($$$)
377 my $node_xhtml_id = shift;
379 my $original_func = \&t2h_default_external_href;
382 # 1) Keep a hash of book->section_map
383 # 2) if not file in keys hash => try to load the map (assign empty map is non-existent => will load only once!)
384 # 3) if node in the section=>(file, anchor) map, replace node_id and node_xhtml_id by the map's values
385 # 4) call the t2h_default_external_href with these values (or the old ones if not found)
386 print STDERR "lilypond_external_href: texi_node='$node', node_file='$node_id', node_xhtml_id='$node_xhtml_id', file='$file'\n";
387 if (($node_id ne '') and defined($file)) {
388 if (!exists($translated_books{$file})) {
389 print STDERR "Map for book $file not yet loaded, trying to initialize\n";
390 # TODO: Load the file...
391 $translated_books{$file}={};
393 my $section_name_map = $translated_books{$file};
394 if (exists($section_name_map->{$node_id})) {
395 print STDERR "Found key $node_id in section_name_map\n";
396 # TODO: Assign the new values to $file, $node_id and $node_xhtml_id!
397 # TODO: Am I doing this right?
399 (my $filename, my $anchor) = @$section_name_map->{$node_id};
400 $filename .= ".$docu_ext" if (defined($docu_ext));
401 print "Stored target: " + $node_to_filename_map->{$node_name};
403 $node_xhtml_id = $anchor;
406 print STDERR "Unable to find key $node_id in section_name_map\n";
409 # Code copied from texi2html:
410 # I'll need to find the correct path to the map file and texi2html already
411 # seems to do a good job for this with the following code, which I will
412 # need to strip down to those parts that we really need:
414 # $file = '' if (!defined($file));
415 # my $default_target_split = $EXTERNAL_CROSSREF_SPLIT;
422 # if ($NEW_CROSSREF_STYLE)
424 # $file =~ s/\.[^\.]*$//;
425 # $file =~ s/^.*\///;
427 # if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}))
429 # if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'split'}))
432 # $href_split = $Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'split'}->{'href'};
434 # if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'mono'}))
437 # $href_mono = $Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'mono'}->{'href'};
441 # if ((not $target_mono) and (not $target_split))
442 # { # nothing specified for that manual, use default
443 # $target_split = $default_target_split;
445 # elsif ($target_split and $target_mono)
446 # { # depends on the splitting of the manual
447 # $target_split = $SPLIT;
449 # elsif ($target_mono)
450 # { # only mono specified
456 # if (defined($href_split))
458 # $file = "$href_split";
460 # elsif (defined($EXTERNAL_DIR))
462 # $file = "$EXTERNAL_DIR/$file";
466 # $file = "../$file";
471 # {# target not split
472 # if (defined($href_mono))
474 # $file = "$href_mono";
478 # if (defined($EXTERNAL_DIR))
480 # $file = "$EXTERNAL_DIR/$file";
484 # $file = "../$file";
486 # $file .= "." . $NODE_FILE_EXTENSION;
493 # if (defined($EXTERNAL_DIR))
495 # $file = $EXTERNAL_DIR . $file;
499 # $file = '../' . $file;
505 # $target_split = $default_target_split;
509 # if ($NEW_CROSSREF_STYLE)
513 # return $file . $TOP_NODE_FILE . '.' . $NODE_FILE_EXTENSION . '#Top';
515 # #return $file . '#Top';
519 # return $file . '#Top';
528 # if ($NEW_CROSSREF_STYLE)
531 # $target = $node_xhtml_id;
535 # $node = main::remove_texi($node);
536 # $node =~ s/[^\w\.\-]/-/g;
538 # my $file_basename = $node;
539 # $file_basename = $TOP_NODE_FILE if ($node =~ /^top$/i);
540 # if ($NEW_CROSSREF_STYLE)
544 # return $file . $file_basename . ".$NODE_FILE_EXTENSION" . '#' . $target;
548 # return $file . '#' . $target;
553 # return $file . $file_basename . ".$NODE_FILE_EXTENSION";
556 return &$original_func($node, $node_id, $node_hxmlt_id, $file);
558 return &$original_func($node, $node_id, $node_hxmlt_id);
566 #############################################################################
567 ### CUSTOM TOC FOR EACH PAGE (in a frame on the left)
568 #############################################################################
570 my $page_toc_depth = 2;
571 my @default_toc = [];
573 # recursively generate the TOC entries for the element and its children (which
574 # are only shown up to maxlevel. All ancestors of the current element are also
575 # shown with their immediate children, irrespective of their level.
576 # Unnumbered entries are only printed out if they are at top-level or their
577 # parent element is an ancestor of the currently viewed node.
578 sub generate_ly_toc_entries($$$$)
581 my $element_path = shift;
582 my $maxlevel = shift;
583 my $always_show_unnumbered_children = shift;
584 # Skip undefined sections, plus all sections generated by index splitting
585 return() if (not defined($element) or exists($element->{'index_page'}));
587 my $level = $element->{'toc_level'};
588 my $is_parent_of_current = $element->{'id'} && $element_path->{$element->{'id'}};
589 my $print_children = ( ($level < $maxlevel) or $is_parent_of_current );
590 my $ind = ' ' x $level;
591 my $this_css_class = $is_parent_of_current ? " class=\"toc_current\"" : "";
593 my $entry = "$ind<li$this_css_class>" . &$anchor ($element->{'tocid'}, "$element->{'file'}#$element->{'id'}",$element->{'text'});
595 my $children = $element->{'section_childs'};
596 # Don't add unnumbered entries, unless they are at top-level or a parent of the current!
597 if (not ($element->{'number'} or $always_show_unnumbered_children)) {
600 if ( $print_children and defined($children) and (ref($children) eq "ARRAY") ) {
601 push (@result, $entry);
602 my @child_result = ();
603 foreach (@$children) {
604 push (@child_result, generate_ly_toc_entries($_, $element_path, $maxlevel, $is_parent_of_current));
606 # if no child nodes were generated, e.g. for the index, where expanded pages
607 # are ignored, don't generate a list at all...
609 push (@result, "\n$ind<ul$NO_BULLET_LIST_ATTRIBUTE>\n");
610 push (@result, @child_result);
611 push (@result, "$ind</ul></li>\n");
614 push (@result, $entry . "</li>\n");
620 # Print a customized TOC, containing only the first two levels plus the whole
621 # path to the current page
622 sub lilypond_generate_page_toc_body($)
625 my $current_element = $element;
627 $parentelements{$element->{'id'}} = 1;
628 # Find the path to the current element
629 while ( defined($current_element->{'sectionup'}) and
630 ($current_element->{'sectionup'} ne $current_element) )
632 $parentelements{$current_element->{'sectionup'}->{'id'}} = 1
633 if ($current_element->{'sectionup'}->{'id'} ne '');
634 $current_element = $current_element->{'sectionup'};
636 return () if not defined($current_element);
637 # Create the toc entries recursively
638 my @toc_entries = ("<div class=\"contents\">\n", "<ul$NO_BULLET_LIST_ATTRIBUTE>\n");
639 my $children = $current_element->{'section_childs'};
640 foreach ( @$children ) {
641 push (@toc_entries, generate_ly_toc_entries($_, \%parentelements, $page_toc_depth, False));
643 push (@toc_entries, "</ul>\n");
644 push (@toc_entries, "</div>\n");
648 sub lilypond_print_toc_div ($$)
652 my @lines = @$tocref;
653 # use default TOC if no custom lines have been generated
654 @lines = @default_toc if (not @lines);
656 print $fh "\n\n<div id=\"tocframe\">\n";
657 print $fh '<h4> ' . $Texi2HTML::NAME{'Contents'} . "</h4>\n";
658 foreach my $line (@lines) {
661 print $fh "</div>\n\n";
665 # Create the custom TOC for this page (partially folded, current page is
666 # highlighted) and store it in a global variable. The TOC is written out after
667 # the html contents (but positioned correctly using CSS), so that browsers with
668 # css turned off still show the contents first.
669 our @this_page_toc = ();
670 sub lilypond_print_element_header
673 my $first_in_page = shift;
674 my $previous_is_top = shift;
675 if ($first_in_page and not @this_page_toc) {
676 if (defined($Texi2HTML::THIS_ELEMENT)) {
677 # Create the TOC for this page
678 @this_page_toc = lilypond_generate_page_toc_body($Texi2HTML::THIS_ELEMENT);
681 return T2H_DEFAULT_print_element_header( $fh, $first_in_page, $previous_is_top);
684 # Generate the HTML output for the TOC
685 sub lilypond_toc_body($)
687 my $elements_list = shift;
688 # Generate a default TOC for pages without THIS_ELEMENT
689 @default_toc = lilypond_generate_page_toc_body(@$elements_list[0]);
690 return T2H_GPL_toc_body($elements_list);
693 # Print out the TOC in a <div> at the beginning of the page
694 sub lilypond_print_page_head($)
697 T2H_DEFAULT_print_page_head($fh);
698 print $fh "<div id=\"main\">\n";
701 # Print out the TOC in a <div> at the end of th page, which will be formatted as a
702 # sidebar mimicking a TOC frame
703 sub print_lilypond_page_foot($)
706 my $program_string = &$program_string();
707 print $fh "<p><font size='-1'>$program_string</font><br>$PRE_BODY_CLOSE</p>\n";
708 print $fh "<!-- FOOTER -->\n\n";
709 print $fh "<!-- end div#main here -->\n</div>\n\n";
711 # Print the TOC frame and reset the TOC:
712 lilypond_print_toc_div ($fh, \@this_page_toc);
716 print $fh "</body>\n</html>\n";
723 #############################################################################
724 ### NICER / MORE FLEXIBLE NAVIGATION PANELS
725 #############################################################################
727 sub get_navigation_text
730 my $text = $NAVIGATION_TEXT{$button};
731 if ( ($button eq 'Back') or ($button eq 'FastBack') ) {
732 $text = $text . $Texi2HTML::NODE{$button} . " ";
733 } elsif ( ($button eq 'Forward') or ($button eq 'FastForward') ) {
734 $text = " " . $Texi2HTML::NODE{$button} . $text;
735 } elsif ( $button eq 'Up' ) {
736 $text = " ".$text.": " . $Texi2HTML::NODE{$button} . " ";
742 # Don't automatically create left-aligned table cells for every link, but
743 # instead create a <td> only on an appropriate '(left|right|center)-aligned-cell-n'
744 # button text. It's alignment as well as the colspan will be taken from the
745 # name of the button. Also, add 'newline' button text to create a new table
746 # row. The texts of the buttons are generated by get_navigation_text and
747 # will contain the name of the next/previous section/chapter.
748 sub lilypond_print_navigation
752 my $vertical = shift;
754 # print $fh '<table cellpadding="', $spacing, '" cellspacing="', $spacing,
755 # "\" border=\"0\" class=\"nav_table\">\n";
756 print $fh "<table class=\"nav_table\">\n";
758 print $fh "<tr>" unless $vertical;
760 foreach my $button (@$buttons)
762 print $fh qq{<tr valign="top" align="left">\n} if $vertical;
763 # Allow (left|right|center)-aligned-cell and newline as buttons!
764 if ( $button =~ /^(.*)-aligned-cell-(.*)$/ )
766 print $fh qq{</td>} unless $beginofline;
767 print $fh qq{<td valign="middle" align="$1" colspan="$2">};
770 elsif ( $button eq 'newline' )
772 print $fh qq{</td>} unless $beginofline;
778 elsif (ref($button) eq 'CODE')
780 &$button($fh, $vertical);
782 elsif (ref($button) eq 'SCALAR')
784 print $fh "$$button" if defined($$button);
786 elsif (ref($button) eq 'ARRAY')
788 my $text = $button->[1];
789 my $button_href = $button->[0];
790 # verify that $button_href is simple text and text is a reference
791 if (defined($button_href) and !ref($button_href)
792 and defined($text) and (ref($text) eq 'SCALAR') and defined($$text))
794 if ($Texi2HTML::HREF{$button_href})
796 my $anchor_attributes = '';
797 if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button_href})) and ($BUTTONS_ACCESSKEY{$button_href} ne ''))
799 $anchor_attributes = "accesskey=\"$BUTTONS_ACCESSKEY{$button_href}\"";
801 if ($USE_REL_REV and (defined($BUTTONS_REL{$button_href})) and ($BUTTONS_REL{$button_href} ne ''))
803 $anchor_attributes .= " rel=\"$BUTTONS_REL{$button_href}\"";
807 $Texi2HTML::HREF{$button_href},
808 get_navigation_text($$text),
814 print $fh get_navigation_text($$text);
818 elsif ($button eq ' ')
819 { # handle space button
821 ($ICONS && $ACTIVE_ICONS{' '}) ?
822 &$button_icon_img($BUTTONS_NAME{$button}, $ACTIVE_ICONS{' '}) :
823 $NAVIGATION_TEXT{' '};
826 elsif ($Texi2HTML::HREF{$button})
828 my $btitle = $BUTTONS_GOTO{$button} ?
829 'title="' . $BUTTONS_GOTO{$button} . '"' : '';
830 if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button})) and ($BUTTONS_ACCESSKEY{$button} ne ''))
832 $btitle .= " accesskey=\"$BUTTONS_ACCESSKEY{$button}\"";
834 if ($USE_REL_REV and (defined($BUTTONS_REL{$button})) and ($BUTTONS_REL{$button} ne ''))
836 $btitle .= " rel=\"$BUTTONS_REL{$button}\"";
838 if ($ICONS && $ACTIVE_ICONS{$button})
842 $Texi2HTML::HREF{$button},
843 &$button_icon_img($BUTTONS_NAME{$button},
844 $ACTIVE_ICONS{$button},
845 $Texi2HTML::SIMPLE_TEXT{$button}),
854 $Texi2HTML::HREF{$button},
855 get_navigation_text ($button),
862 { # button is passive
864 $ICONS && $PASSIVE_ICONS{$button} ?
865 &$button_icon_img($BUTTONS_NAME{$button},
866 $PASSIVE_ICONS{$button},
867 $Texi2HTML::SIMPLE_TEXT{$button}) :
869 "[" . get_navigation_text($button) . "]";
871 print $fh "</td>\n" if $vertical;
872 print $fh "</tr>\n" if $vertical;
874 print $fh "</td>" unless $beginofline;
875 print $fh "</tr>" unless $vertical;
876 print $fh "</table>\n";
880 @Texi2HTML::Config::SECTION_BUTTONS =
881 ('left-aligned-cell-1', 'FastBack',
882 'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
883 'right-aligned-cell-1', 'FastForward',
885 'left-aligned-cell-2', 'Back',
886 'center-aligned-cell-1', 'Up',
887 'right-aligned-cell-2', 'Forward'
890 # buttons for misc stuff
891 @Texi2HTML::Config::MISC_BUTTONS = ('center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About');
893 # buttons for chapter file footers
894 # (and headers but only if SECTION_NAVIGATION is false)
895 @Texi2HTML::Config::CHAPTER_BUTTONS =
896 ('left-aligned-cell-1', 'FastBack',
897 'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
898 'right-aligned-cell-1', 'FastForward',
901 # buttons for section file footers
902 @Texi2HTML::Config::SECTION_FOOTER_BUTTONS =
903 ('left-aligned-cell-1', 'FastBack',
904 'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
905 'right-aligned-cell-1', 'FastForward',
907 'left-aligned-cell-2', 'Back',
908 'center-aligned-cell-1', 'Up',
909 'right-aligned-cell-2', 'Forward'
912 @Texi2HTML::Config::NODE_FOOTER_BUTTONS =
913 ('left-aligned-cell-1', 'FastBack',
914 'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
915 'right-aligned-cell-1', 'FastForward',
917 'left-aligned-cell-2', 'Back',
918 'center-aligned-cell-1', 'Up',
919 'right-aligned-cell-2', 'Forward'
926 #############################################################################
928 #############################################################################
930 # For split pages, use index.html as start page!
931 if ($Texi2HTML::Config::SPLIT == 'section') {
932 $Texi2HTML::Config::TOP_FILE = 'index.html';