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 ### -) Different formatting than the default: example uses the same formatting
32 ### -) Allow translated section titles: All section titles can be translated,
33 ### the original (English) title is associated with @translationof. This is
34 ### needed, because the file name / anchor is generated from the original
35 ### English title, since otherwise language-autoselection would break with
37 ### Since it is then no longer possible to obtain the file name from the
38 ### section title, I keep a sectionname<=>filename/anchor around. This way,
39 ### xrefs from other manuals can simply load that map and retrieve the
40 ### correct file name for the link. Implemented in:
41 ### lilypond_unknown (handling of @translationof, in case
42 ### extract_texi_filenames.py messes up...)
43 ### split_at_numbered_sections (correct file name: use the map)
44 ### lilypond_init_out (read in the externally created map from disk)
45 ### lilypond_external_href (load the map for xrefs, use the correct
49 ### Useful helper functions:
50 ### -) texinfo_file_name($node_name): returns a texinfo-compatible file name
51 ### for the given string $node_name (whitespace trimmed/replaced by -,
52 ### non-standard chars replaced by _xxxx (ascii char code) and forced to
53 ### start with a letter by prepending t_g if necessary)
56 package Texi2HTML::Config;
62 #############################################################################
63 ### SETTINGS FOR TEXI2HTML
64 #############################################################################
66 @Texi2HTML::Config::CSS_REFS = ("lilypond.css");
67 $Texi2HTML::Config::USE_ACCESSKEY = 1;
68 $Texi2HTML::Config::USE_LINKS = 1;
69 $Texi2HTML::Config::USE_REL_REV = 1;
70 $Texi2HTML::Config::element_file_name = \&split_at_numbered_sections;
71 $Texi2HTML::Config::print_element_header = \&lilypond_print_element_header;
72 $Texi2HTML::Config::print_page_foot = \&print_lilypond_page_foot;
73 $Texi2HTML::Config::print_navigation = \&lilypond_print_navigation;
74 $Texi2HTML::Config::external_ref = \&lilypond_external_ref;
75 $Texi2HTML::Config::external_href = \&lilypond_external_href;
76 $Texi2HTML::Config::toc_body = \&lilypond_toc_body;
77 $Texi2HTML::Config::css_lines = \&lilypond_css_lines;
78 $Texi2HTML::Config::init_out = \&lilypond_init_out;
79 $Texi2HTML::Config::unknown = \&lilypond_unknown;
80 $Texi2HTML::Config::print_page_head = \&lilypond_print_page_head;
82 # Examples should be formatted similar to quotes:
83 $Texi2HTML::Config::complex_format_map->{'example'} = {
84 'begin' => q{"<blockquote><pre class=\"example\">"},
85 'end' => q{"</pre></blockquote>\n"},
89 my @section_to_filename;
94 #############################################################################
96 #############################################################################
99 $Data::Dumper::Maxdepth = 2;
101 sub print_element_info($)
104 print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
105 print "Element: $element\n";
106 print Dumper($element);
113 #############################################################################
115 #############################################################################
117 # Convert a given node name to its proper file name (normalization as explained
118 # in the texinfo manual:
119 # http://www.gnu.org/software/texinfo/manual/texinfo/html_node/HTML-Xref-Node-Name-Expansion.html
120 sub texinfo_file_name($)
124 # File name normalization by texinfo:
125 # 1/2: letters and numbers are left unchanged
126 # 3/4: multiple, leading and trailing whitespace is removed
127 $text = main::normalise_space($text);
128 # 5/6: all remaining spaces are converted to '-', all other 7- or 8-bit
129 # chars are replaced by _xxxx (xxxx=ascii character code)
130 while ($text ne '') {
131 if ($text =~ s/^([A-Za-z0-9]+)//o) { # number or letter stay unchanged
133 } elsif ($text =~ s/^ //o) { # space -> '-'
135 } elsif ($text =~ s/^(.)//o) { # Otherwise use _xxxx (ascii char code)
137 if ( $ccode <= 0xFFFF ) {
138 $result .= sprintf("_%04x", $ccode);
140 $result .= sprintf("__%06x", $ccode);
144 # 7: if name does not begin with a letter, prepend 't_g' (so it starts with a letter)
145 if ($result !~ /^[a-zA-Z]/) {
146 $result = 't_g' . $result;
153 # Load a file containing a nodename<=>filename map (tab-sepatared, i.e.
154 # NODENAME\tFILENAME\tANCHOR
155 # Returns a ref to a hash "Node title" => ["FilenameWithoutExt", "Anchor"]
156 sub load_map_file ($)
160 # TODO: Load and parse the file
162 if (open(XREFFILE, $mapfilename)) {
163 @nodelist = <XREFFILE>;
165 # parse the tab-separated entries and insert them into the map:
166 foreach $node (@nodelist) {
168 my @entries = split(/\t/, $node);
169 if (length (@entries) == 3) {
170 $node_map->{$entries[0]} = [$entries[1], $entries[2]];
172 print STDERR "Invalid entry in the node file $mapfile: $node\n";
176 print STDERR "Unable to load the map file $mapfile\n";
185 #############################################################################
187 #############################################################################
189 # Include our standard CSS file, not hard-coded CSS code directly in the HTML!
190 # For IE, conditionally include the lilypond-ie-fixes.css style sheet
191 sub lilypond_css_lines ($$)
193 my $import_lines = shift;
194 my $rule_lines = shift;
195 return if (defined($CSS_LINES));
196 if (@$rule_lines or @$import_lines)
198 $CSS_LINES = "<style type=\"text/css\">\n<!--\n";
199 $CSS_LINES .= join('',@$import_lines) . "\n" if (@$import_lines);
200 $CSS_LINES .= join('',@$rule_lines) . "\n" if (@$rule_lines);
201 $CSS_LINES .= "-->\n</style>\n";
203 foreach my $ref (@CSS_REFS)
205 $CSS_LINES .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"$ref\">\n";
207 $CSS_LINES .= "<!--[if lte IE 7]>\n<link href=\"lilypond-ie-fixes.css\" rel=\"stylesheet\" type=\"text/css\">\n<![endif]-->\n";
214 #############################################################################
215 ### SPLITTING BASED ON NUMBERED SECTIONS
216 #############################################################################
220 my $node_to_filename_map = ();
222 # This function makes sure that files are only generated for numbered sections,
223 # but not for unnumbered ones. It is called after texi2html has done its own
224 # splitting and simply returns the filename for the node given as first argument
225 # Nodes with the same filename will be printed out to the same filename, so
226 # this really all we need. Also, make sure that the file names for sections
227 # are derived from the section title. We also might want to name the anchors
228 # according to node titles, which works by simply overriding the id element of
230 # If an external nodename<=>filename/anchor map file is found (loaded in
231 # lilypond_init_out, use the externally created values, otherwise use the
233 sub split_at_numbered_sections($$$)
237 my $docu_name = shift;
238 my $docu_ext = $Texi2HTML::Config::EXTENSION;
240 my $node_name = $element->{'node_ref'}->{'no_texi'};
241 if (exists ($node_to_filename_map->{$node_name})) {
242 (my $filename, my $anchor) = @$node_to_filename_map->{$node_name};
243 $filename .= ".$docu_ext" if (defined($docu_ext));
244 # TODO: Does this work?
245 print "Stored target: " + $node_to_filename_map->{$node_name};
246 $element->{id} = $anchor;
247 if ($filename == $lastfilename) {
248 $$element{doc_nr} = $docnr;
251 $$element{doc_nr} = $docnr;
252 $lastfilename = $filename;
256 } elsif ($type eq "top" or $type eq "toc" or $type eq "doc" or $type eq "stoc" or $type eq "foot" or $type eq "about") {
257 # TOC, footer, about etc. are called with undefined $element and $type == "toc"|"stoc"|"foot"|"about"
260 # If we have an entry in the section<=>filename map, use that one, otherwise
261 # generate the filename/anchor here. In the latter case, external manuals
262 # will not be able to retrieve the file name for xrefs!!! Still, I already
263 # had that code, so I'll leave it in in case something goes wrong with the
264 #extract_texi_filenames.py script in the lilypond build process!
265 # TODO: lookup node name in nodename<=>filename map
267 # derive the name of the anchor (i.e. the part after # in the links!),
268 # don't use texi2html's SECx.x default!
270 my $sec_name = main::remove_texi($element->{'texi'});
271 if ($element->{'node_ref'}->{'texi'} ne '') { # if we have a node, use its name:
272 $sec_name = main::remove_texi($element->{'node_ref'}->{'texi'});
274 my $anchor = $sec_name;
275 if ($$element{translationof}) {
276 $anchor = main::remove_texi($$element{translationof});
278 # normalize to the same file name as texinfo
279 $anchor = texinfo_file_name($anchor);
280 $$element{id} = $anchor;
281 # Numbered sections will get a filename Node_title, unnumbered sections will use
282 # the file name of the previous numbered section:
283 if (($element->{number}) or ($lastfilename eq '') or ($element->{level} == 1)) {
284 my $filename = $anchor;
285 $filename .= ".$docu_ext" if (defined($docu_ext));
287 $$element{doc_nr} = $docnr;
288 $lastfilename = $filename;
291 $$element{doc_nr} = $docnr;
292 return $lastfilename;
299 sub lilypond_init_out ()
301 t2h_default_init_out ();
302 # TODO: find correct path to the map file
303 # my $map_filename = "$Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'file_base_name'}_xref.map";
304 my $map_filename = "$Texi2HTML::THISDOC{'file_base_name'}_xref.map";
305 $node_to_filename_map = load_map_file ($map_filename);
309 #############################################################################
310 ### CLEANER LINK TITLE FOR EXTERNAL REFS
311 #############################################################################
313 # The default formatting of external refs returns e.g.
314 # "(lilypond-internals)Timing_translator", so we remove all (...) from the
315 # file_and_node argument. Also, we want only a very simple format, so we don't
316 # even call the default handler!
317 sub lilypond_external_ref($$$$$$)
322 my $file_node = shift;
324 my $cross_ref = shift;
326 $file_node =~ s/\(.*\)//;
327 $file_node = &$anchor('', $href, $file_node) if ($file_node ne '');
328 return &$I('%{node_file_href}', { 'node_file_href' => $file_node });
330 # Default: format as "see <a ..>NODE</a> section 'SECTION' in BOOK". We don't want this!
331 # return t2h_default_external_ref($type, $section, $book, $file_node, $href, $cross_ref);
338 #############################################################################
339 ### HANDLING TRANSLATED SECTIONS: handle @translationof, secname<->filename
340 ### map stored on disk, xrefs in other manuals load that map
341 #############################################################################
344 # Try to make use of @translationof to generate files according to the original
345 # English section title...
346 sub lilypond_unknown($$$$$)
354 # the @translationof macro provides the original English section title,
355 # which should be used for file/anchor naming, while the title will be
356 # translated to each language
357 # It is already used by extract_texi_filenames.py, so this should not be
358 # necessary here at all. Still, I'll leave the code in just in case the
359 # python script messed up ;-)
360 if ($pass == 1 and $macro eq "translationof") {
361 if (ref($state->{'element'})=='HASH') {
362 $state->{'element'}->{'translationof'} = main::normalise_space($line);
364 return ('', true, undef, undef);
366 return t2h_default_unknown($macro, $line, $pass, $stack, $state);
373 my %translated_books = ();
374 # Construct a href to an external source of information.
375 # node is the node with texinfo @-commands
376 # node_id is the node transliterated and transformed as explained in the
378 # node_xhtml_id is the node transformed such that it is unique and can
379 # be used to make an html cross ref as explained in the texinfo manual
380 # file is the file in '(file)node'
381 sub lilypond_external_href($$$)
385 my $node_xhtml_id = shift;
387 my $original_func = \&t2h_default_external_href;
390 # 1) Keep a hash of book->section_map
391 # 2) if not file in keys hash => try to load the map (assign empty map is non-existent => will load only once!)
392 # 3) if node in the section=>(file, anchor) map, replace node_id and node_xhtml_id by the map's values
393 # 4) call the t2h_default_external_href with these values (or the old ones if not found)
394 print STDERR "lilypond_external_href: texi_node='$node', node_file='$node_id', node_xhtml_id='$node_xhtml_id', file='$file'\n";
395 if (($node_id ne '') and defined($file)) {
396 if (!exists($translated_books{$file})) {
397 print STDERR "Map for book $file not yet loaded, trying to initialize\n";
398 # TODO: Load the file...
399 $translated_books{$file}={};
401 my $section_name_map = $translated_books{$file};
402 if (exists($section_name_map->{$node_id})) {
403 print STDERR "Found key $node_id in section_name_map\n";
404 # TODO: Assign the new values to $file, $node_id and $node_xhtml_id!
405 # TODO: Am I doing this right?
407 (my $filename, my $anchor) = @$section_name_map->{$node_id};
408 $filename .= ".$docu_ext" if (defined($docu_ext));
409 print "Stored target: " + $node_to_filename_map->{$node_name};
411 $node_xhtml_id = $anchor;
414 print STDERR "Unable to find key $node_id in section_name_map\n";
417 # Code copied from texi2html:
418 # I'll need to find the correct path to the map file and texi2html already
419 # seems to do a good job for this with the following code, which I will
420 # need to strip down to those parts that we really need:
422 # $file = '' if (!defined($file));
423 # my $default_target_split = $EXTERNAL_CROSSREF_SPLIT;
430 # if ($NEW_CROSSREF_STYLE)
432 # $file =~ s/\.[^\.]*$//;
433 # $file =~ s/^.*\///;
435 # if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}))
437 # if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'split'}))
440 # $href_split = $Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'split'}->{'href'};
442 # if (exists($Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'mono'}))
445 # $href_mono = $Texi2HTML::THISDOC{'htmlxref'}->{$file}->{'mono'}->{'href'};
449 # if ((not $target_mono) and (not $target_split))
450 # { # nothing specified for that manual, use default
451 # $target_split = $default_target_split;
453 # elsif ($target_split and $target_mono)
454 # { # depends on the splitting of the manual
455 # $target_split = $SPLIT;
457 # elsif ($target_mono)
458 # { # only mono specified
464 # if (defined($href_split))
466 # $file = "$href_split";
468 # elsif (defined($EXTERNAL_DIR))
470 # $file = "$EXTERNAL_DIR/$file";
474 # $file = "../$file";
479 # {# target not split
480 # if (defined($href_mono))
482 # $file = "$href_mono";
486 # if (defined($EXTERNAL_DIR))
488 # $file = "$EXTERNAL_DIR/$file";
492 # $file = "../$file";
494 # $file .= "." . $NODE_FILE_EXTENSION;
501 # if (defined($EXTERNAL_DIR))
503 # $file = $EXTERNAL_DIR . $file;
507 # $file = '../' . $file;
513 # $target_split = $default_target_split;
517 # if ($NEW_CROSSREF_STYLE)
521 # return $file . $TOP_NODE_FILE . '.' . $NODE_FILE_EXTENSION . '#Top';
523 # #return $file . '#Top';
527 # return $file . '#Top';
536 # if ($NEW_CROSSREF_STYLE)
539 # $target = $node_xhtml_id;
543 # $node = main::remove_texi($node);
544 # $node =~ s/[^\w\.\-]/-/g;
546 # my $file_basename = $node;
547 # $file_basename = $TOP_NODE_FILE if ($node =~ /^top$/i);
548 # if ($NEW_CROSSREF_STYLE)
552 # return $file . $file_basename . ".$NODE_FILE_EXTENSION" . '#' . $target;
556 # return $file . '#' . $target;
561 # return $file . $file_basename . ".$NODE_FILE_EXTENSION";
564 return &$original_func($node, $node_id, $node_hxmlt_id, $file);
566 return &$original_func($node, $node_id, $node_hxmlt_id);
574 #############################################################################
575 ### CUSTOM TOC FOR EACH PAGE (in a frame on the left)
576 #############################################################################
578 my $page_toc_depth = 2;
579 my @default_toc = [];
581 # recursively generate the TOC entries for the element and its children (which
582 # are only shown up to maxlevel. All ancestors of the current element are also
583 # shown with their immediate children, irrespective of their level.
584 # Unnumbered entries are only printed out if they are at top-level or their
585 # parent element is an ancestor of the currently viewed node.
586 sub generate_ly_toc_entries($$$$)
589 my $element_path = shift;
590 my $maxlevel = shift;
591 my $always_show_unnumbered_children = shift;
592 # Skip undefined sections, plus all sections generated by index splitting
593 return() if (not defined($element) or exists($element->{'index_page'}));
595 my $level = $element->{'toc_level'};
596 my $is_parent_of_current = $element->{'id'} && $element_path->{$element->{'id'}};
597 my $print_children = ( ($level < $maxlevel) or $is_parent_of_current );
598 my $ind = ' ' x $level;
599 my $this_css_class = $is_parent_of_current ? " class=\"toc_current\"" : "";
601 my $entry = "$ind<li$this_css_class>" . &$anchor ($element->{'tocid'}, "$element->{'file'}#$element->{'id'}",$element->{'text'});
603 my $children = $element->{'section_childs'};
604 # Don't add unnumbered entries, unless they are at top-level or a parent of the current!
605 if (not ($element->{'number'} or $always_show_unnumbered_children)) {
608 if ( $print_children and defined($children) and (ref($children) eq "ARRAY") ) {
609 push (@result, $entry);
610 my @child_result = ();
611 foreach (@$children) {
612 push (@child_result, generate_ly_toc_entries($_, $element_path, $maxlevel, $is_parent_of_current));
614 # if no child nodes were generated, e.g. for the index, where expanded pages
615 # are ignored, don't generate a list at all...
617 push (@result, "\n$ind<ul$NO_BULLET_LIST_ATTRIBUTE>\n");
618 push (@result, @child_result);
619 push (@result, "$ind</ul></li>\n");
622 push (@result, $entry . "</li>\n");
628 # Print a customized TOC, containing only the first two levels plus the whole
629 # path to the current page
630 sub lilypond_generate_page_toc_body($)
633 my $current_element = $element;
635 $parentelements{$element->{'id'}} = 1;
636 # Find the path to the current element
637 while ( defined($current_element->{'sectionup'}) and
638 ($current_element->{'sectionup'} ne $current_element) )
640 $parentelements{$current_element->{'sectionup'}->{'id'}} = 1
641 if ($current_element->{'sectionup'}->{'id'} ne '');
642 $current_element = $current_element->{'sectionup'};
644 return () if not defined($current_element);
645 # Create the toc entries recursively
646 my @toc_entries = ("<div class=\"contents\">\n", "<ul$NO_BULLET_LIST_ATTRIBUTE>\n");
647 my $children = $current_element->{'section_childs'};
648 foreach ( @$children ) {
649 push (@toc_entries, generate_ly_toc_entries($_, \%parentelements, $page_toc_depth, False));
651 push (@toc_entries, "</ul>\n");
652 push (@toc_entries, "</div>\n");
656 sub lilypond_print_toc_div ($$)
660 my @lines = @$tocref;
661 # use default TOC if no custom lines have been generated
662 @lines = @default_toc if (not @lines);
664 print $fh "\n\n<div id=\"tocframe\">\n";
665 print $fh '<h4> ' . $Texi2HTML::NAME{'Contents'} . "</h4>\n";
666 foreach my $line (@lines) {
669 print $fh "</div>\n\n";
673 # Create the custom TOC for this page (partially folded, current page is
674 # highlighted) and store it in a global variable. The TOC is written out after
675 # the html contents (but positioned correctly using CSS), so that browsers with
676 # css turned off still show the contents first.
677 our @this_page_toc = ();
678 sub lilypond_print_element_header
681 my $first_in_page = shift;
682 my $previous_is_top = shift;
683 if ($first_in_page and not @this_page_toc) {
684 if (defined($Texi2HTML::THIS_ELEMENT)) {
685 # Create the TOC for this page
686 @this_page_toc = lilypond_generate_page_toc_body($Texi2HTML::THIS_ELEMENT);
689 return T2H_DEFAULT_print_element_header( $fh, $first_in_page, $previous_is_top);
692 # Generate the HTML output for the TOC
693 sub lilypond_toc_body($)
695 my $elements_list = shift;
696 # Generate a default TOC for pages without THIS_ELEMENT
697 @default_toc = lilypond_generate_page_toc_body(@$elements_list[0]);
698 return T2H_GPL_toc_body($elements_list);
701 # Print out the TOC in a <div> at the beginning of the page
702 sub lilypond_print_page_head($)
705 T2H_DEFAULT_print_page_head($fh);
706 print $fh "<div id=\"main\">\n";
709 # Print out the TOC in a <div> at the end of th page, which will be formatted as a
710 # sidebar mimicking a TOC frame
711 sub print_lilypond_page_foot($)
714 my $program_string = &$program_string();
715 print $fh "<p><font size='-1'>$program_string</font><br>$PRE_BODY_CLOSE</p>\n";
716 print $fh "<!-- FOOTER -->\n\n";
717 print $fh "<!-- end div#main here -->\n</div>\n\n";
719 # Print the TOC frame and reset the TOC:
720 lilypond_print_toc_div ($fh, \@this_page_toc);
724 print $fh "</body>\n</html>\n";
731 #############################################################################
732 ### NICER / MORE FLEXIBLE NAVIGATION PANELS
733 #############################################################################
735 sub get_navigation_text
738 my $text = $NAVIGATION_TEXT{$button};
739 if ( ($button eq 'Back') or ($button eq 'FastBack') ) {
740 $text = $text . $Texi2HTML::NODE{$button} . " ";
741 } elsif ( ($button eq 'Forward') or ($button eq 'FastForward') ) {
742 $text = " " . $Texi2HTML::NODE{$button} . $text;
743 } elsif ( $button eq 'Up' ) {
744 $text = " ".$text.": " . $Texi2HTML::NODE{$button} . " ";
750 # Don't automatically create left-aligned table cells for every link, but
751 # instead create a <td> only on an appropriate '(left|right|center)-aligned-cell-n'
752 # button text. It's alignment as well as the colspan will be taken from the
753 # name of the button. Also, add 'newline' button text to create a new table
754 # row. The texts of the buttons are generated by get_navigation_text and
755 # will contain the name of the next/previous section/chapter.
756 sub lilypond_print_navigation
760 my $vertical = shift;
762 # print $fh '<table cellpadding="', $spacing, '" cellspacing="', $spacing,
763 # "\" border=\"0\" class=\"nav_table\">\n";
764 print $fh "<table class=\"nav_table\">\n";
766 print $fh "<tr>" unless $vertical;
768 foreach my $button (@$buttons)
770 print $fh qq{<tr valign="top" align="left">\n} if $vertical;
771 # Allow (left|right|center)-aligned-cell and newline as buttons!
772 if ( $button =~ /^(.*)-aligned-cell-(.*)$/ )
774 print $fh qq{</td>} unless $beginofline;
775 print $fh qq{<td valign="middle" align="$1" colspan="$2">};
778 elsif ( $button eq 'newline' )
780 print $fh qq{</td>} unless $beginofline;
786 elsif (ref($button) eq 'CODE')
788 &$button($fh, $vertical);
790 elsif (ref($button) eq 'SCALAR')
792 print $fh "$$button" if defined($$button);
794 elsif (ref($button) eq 'ARRAY')
796 my $text = $button->[1];
797 my $button_href = $button->[0];
798 # verify that $button_href is simple text and text is a reference
799 if (defined($button_href) and !ref($button_href)
800 and defined($text) and (ref($text) eq 'SCALAR') and defined($$text))
802 if ($Texi2HTML::HREF{$button_href})
804 my $anchor_attributes = '';
805 if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button_href})) and ($BUTTONS_ACCESSKEY{$button_href} ne ''))
807 $anchor_attributes = "accesskey=\"$BUTTONS_ACCESSKEY{$button_href}\"";
809 if ($USE_REL_REV and (defined($BUTTONS_REL{$button_href})) and ($BUTTONS_REL{$button_href} ne ''))
811 $anchor_attributes .= " rel=\"$BUTTONS_REL{$button_href}\"";
815 $Texi2HTML::HREF{$button_href},
816 get_navigation_text($$text),
822 print $fh get_navigation_text($$text);
826 elsif ($button eq ' ')
827 { # handle space button
829 ($ICONS && $ACTIVE_ICONS{' '}) ?
830 &$button_icon_img($BUTTONS_NAME{$button}, $ACTIVE_ICONS{' '}) :
831 $NAVIGATION_TEXT{' '};
834 elsif ($Texi2HTML::HREF{$button})
836 my $btitle = $BUTTONS_GOTO{$button} ?
837 'title="' . $BUTTONS_GOTO{$button} . '"' : '';
838 if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button})) and ($BUTTONS_ACCESSKEY{$button} ne ''))
840 $btitle .= " accesskey=\"$BUTTONS_ACCESSKEY{$button}\"";
842 if ($USE_REL_REV and (defined($BUTTONS_REL{$button})) and ($BUTTONS_REL{$button} ne ''))
844 $btitle .= " rel=\"$BUTTONS_REL{$button}\"";
846 if ($ICONS && $ACTIVE_ICONS{$button})
850 $Texi2HTML::HREF{$button},
851 &$button_icon_img($BUTTONS_NAME{$button},
852 $ACTIVE_ICONS{$button},
853 $Texi2HTML::SIMPLE_TEXT{$button}),
862 $Texi2HTML::HREF{$button},
863 get_navigation_text ($button),
870 { # button is passive
872 $ICONS && $PASSIVE_ICONS{$button} ?
873 &$button_icon_img($BUTTONS_NAME{$button},
874 $PASSIVE_ICONS{$button},
875 $Texi2HTML::SIMPLE_TEXT{$button}) :
877 "[" . get_navigation_text($button) . "]";
879 print $fh "</td>\n" if $vertical;
880 print $fh "</tr>\n" if $vertical;
882 print $fh "</td>" unless $beginofline;
883 print $fh "</tr>" unless $vertical;
884 print $fh "</table>\n";
888 @Texi2HTML::Config::SECTION_BUTTONS =
889 ('left-aligned-cell-1', 'FastBack',
890 'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
891 'right-aligned-cell-1', 'FastForward',
893 'left-aligned-cell-2', 'Back',
894 'center-aligned-cell-1', 'Up',
895 'right-aligned-cell-2', 'Forward'
898 # buttons for misc stuff
899 @Texi2HTML::Config::MISC_BUTTONS = ('center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About');
901 # buttons for chapter file footers
902 # (and headers but only if SECTION_NAVIGATION is false)
903 @Texi2HTML::Config::CHAPTER_BUTTONS =
904 ('left-aligned-cell-1', 'FastBack',
905 'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
906 'right-aligned-cell-1', 'FastForward',
909 # buttons for section file footers
910 @Texi2HTML::Config::SECTION_FOOTER_BUTTONS =
911 ('left-aligned-cell-1', 'FastBack',
912 'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
913 'right-aligned-cell-1', 'FastForward',
915 'left-aligned-cell-2', 'Back',
916 'center-aligned-cell-1', 'Up',
917 'right-aligned-cell-2', 'Forward'
920 @Texi2HTML::Config::NODE_FOOTER_BUTTONS =
921 ('left-aligned-cell-1', 'FastBack',
922 'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
923 'right-aligned-cell-1', 'FastForward',
925 'left-aligned-cell-2', 'Back',
926 'center-aligned-cell-1', 'Up',
927 'right-aligned-cell-2', 'Forward'
934 #############################################################################
936 #############################################################################
938 # For split pages, use index.html as start page!
939 if ($Texi2HTML::Config::SPLIT == 'section') {
940 $Texi2HTML::Config::TOP_FILE = 'index.html';