From 227cb14ef4c8a5124fc922ceeb7af6e711dd221b Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Wed, 23 Jul 2008 16:13:21 +0200 Subject: [PATCH] texi2html: Make layout work with IE, cleaner HTML output -) Wrap
around main contents, insert footer at the end of this div -) Fix linebreaks in the TOC HTML code -) Properly use global variable "our @this_page_toc" Thanks to "Patrick McCarty" for the trickery with IE CSS problems! --- Documentation/lilypond-ie-fixes.css | 21 +++++++-- Documentation/lilypond.css | 67 ++++++++++++++++------------- lilypond-texi2html.init | 59 ++++++++++++++++--------- 3 files changed, 94 insertions(+), 53 deletions(-) diff --git a/Documentation/lilypond-ie-fixes.css b/Documentation/lilypond-ie-fixes.css index 0a27395519..8a068900f0 100644 --- a/Documentation/lilypond-ie-fixes.css +++ b/Documentation/lilypond-ie-fixes.css @@ -3,11 +3,26 @@ /***********************************************************/ body { height: 100%; - overflow: hidden; font-size: 100%; + min-height: 0; } + +/***********************************************************/ +/* MAIN CONTENT */ +/***********************************************************/ + div#main { - width: 100%; + min-height: 0; height: 100%; - overflow: auto; + width: 73%; + overflow-x: auto; } + +/***********************************************************/ +/* TOC SIDEBAR */ +/***********************************************************/ + +div#tocframe { + height: 100%; + width: 27%; +} diff --git a/Documentation/lilypond.css b/Documentation/lilypond.css index d646401803..f82b6d8cf8 100644 --- a/Documentation/lilypond.css +++ b/Documentation/lilypond.css @@ -1,7 +1,16 @@ /***********************************************************/ /* PAGE-WIDE SETTINGS */ -/***********************************************************/ +/**********************************************************/ + +html { + height:100%; +} + body { + margin: 0; + padding: 0; + height: 100%; + font-size: 100%; margin-right: auto; margin-left: auto; } @@ -67,54 +76,52 @@ table.cartouche td { } /***********************************************************/ -/* TOC */ +/* MAIN CONTENT */ /***********************************************************/ -.contents { - border: 1px dashed #339999; - margin: 3px 2em; - list-style-type: square; - padding-right: 1em; - width: 40em; - background-color: #fcfff9; + +div#main { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 27%; + padding: 0 1em; + margin: 0; + overflow: auto; } +#languages { + padding-bottom: 1em; +} /***********************************************************/ /* TOC SIDEBAR */ /***********************************************************/ -body { - padding-left: 27%; /* To create space for the sidebar! */ -} -div#main { -} + div#tocframe { -/* position: fixed; */ position: absolute; top: 0; + right: 73%; + bottom: 0; left: 0; - margin: 0em; padding: 5px; - width: 25%; - height: 100%; + padding-bottom: 0; + margin: 0; overflow: auto; background-color: #FFFACD; z-index:100; list-style-type: none; - -/* float: left; */ -/* clear: both; */ } -@media screen - { - body>div#tocframe - { - position: fixed; +@media screen { + body>div#tocframe { + position: fixed } } #tocframe .contents { width: 100%; + padding-bottom: 0.25em; border: none; margin: 0em; background-color: transparent; @@ -153,13 +160,15 @@ li.toc_current ul { /***********************************************************/ /* NAVIGATION */ /***********************************************************/ + .nav_table { - width: 98%; - background-color: #CCCCCC; + width: 100%; + background-color: #CCC; border: 0; + margin-top: 4px; left: auto; right: auto; - font-size: 10pt; + font-size: 0.8em; } diff --git a/lilypond-texi2html.init b/lilypond-texi2html.init index e2d69c7390..048a7f33d0 100644 --- a/lilypond-texi2html.init +++ b/lilypond-texi2html.init @@ -16,7 +16,8 @@ ### to every page; implemented by: ### lilypond_print_element_header -- building of the TOC ### lilypond_toc_body -- generation of customized TOC output -### print_lilypond_page_foot -- output of the TOC +### lilypond_print_page_head -- start
+### print_lilypond_page_foot -- closing id=main, output of footer & TOC ### -) External refs are formatted only as "Text of the node" (not as >>see ### "NODE" section "SECTION" in "BOOK"<< like with default texi2html). Also, ### the leading "(book-name)" is removed. @@ -74,6 +75,7 @@ $Texi2HTML::Config::toc_body = \&lilypond_toc_body; $Texi2HTML::Config::css_lines = \&lilypond_css_lines; $Texi2HTML::Config::init_out = \&lilypond_init_out; $Texi2HTML::Config::unknown = \&lilypond_unknown; +$Texi2HTML::Config::print_page_head = \&lilypond_print_page_head; my @section_to_filename; @@ -231,6 +233,7 @@ sub split_at_numbered_sections($$$) if (exists ($node_to_filename_map->{$node_name})) { (my $filename, my $anchor) = @$node_to_filename_map->{$node_name}; $filename .= ".$docu_ext" if (defined($docu_ext)); + # TODO: Does this work? print "Stored target: " + $node_to_filename_map->{$node_name}; $element->{id} = $anchor; if ($filename == $lastfilename) { @@ -287,12 +290,11 @@ sub split_at_numbered_sections($$$) sub lilypond_init_out () { - print "Init out\n"; t2h_default_init_out (); + # TODO: find correct path to the map file # my $map_filename = "$Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'file_base_name'}_xref.map"; my $map_filename = "$Texi2HTML::THISDOC{'file_base_name'}_xref.map"; $node_to_filename_map = load_map_file ($map_filename); - print Dumper ($node_to_filename_map); } @@ -604,7 +606,7 @@ sub generate_ly_toc_entries($$$$) # if no child nodes were generated, e.g. for the index, where expanded pages # are ignored, don't generate a list at all... if (@child_result) { - push (@result, "$ind"); + push (@result, "\n$ind\n"); push (@result, @child_result); push (@result, "$ind\n"); } @@ -633,22 +635,38 @@ sub lilypond_generate_page_toc_body($) } return () if not defined($current_element); # Create the toc entries recursively - my @toc_entries = ("
", ""); + my @toc_entries = ("
\n", "\n"); my $children = $current_element->{'section_childs'}; foreach ( @$children ) { push (@toc_entries, generate_ly_toc_entries($_, \%parentelements, $page_toc_depth, False)); } - push (@toc_entries, ""); - push (@toc_entries, "
"); + push (@toc_entries, "\n"); + push (@toc_entries, "
\n"); return @toc_entries; } +sub lilypond_print_toc_div ($$) +{ + my $fh = shift; + my $tocref = shift; + my @lines = @$tocref; + # use default TOC if no custom lines have been generated + @lines = @default_toc if (not @lines); + if (@lines) { + print $fh "\n\n
\n"; + print $fh '

' . $Texi2HTML::NAME{'Contents'} . "

\n"; + foreach my $line (@lines) { + print $fh $line; + } + print $fh "
\n\n"; + } +} # Create the custom TOC for this page (partially folded, current page is # highlighted) and store it in a global variable. The TOC is written out after # the html contents (but positioned correctly using CSS), so that browsers with # css turned off still show the contents first. -my @this_page_toc = (); +our @this_page_toc = (); sub lilypond_print_element_header { my $fh = shift; @@ -672,6 +690,13 @@ sub lilypond_toc_body($) return T2H_GPL_toc_body($elements_list); } +# Print out the TOC in a
at the beginning of the page +sub lilypond_print_page_head($) +{ + my $fh = shift; + T2H_DEFAULT_print_page_head($fh); + print $fh "
\n"; +} # Print out the TOC in a
at the end of th page, which will be formatted as a # sidebar mimicking a TOC frame @@ -680,20 +705,12 @@ sub print_lilypond_page_foot($) my $fh = shift; my $program_string = &$program_string(); print $fh "

$program_string
$PRE_BODY_CLOSE

\n"; + print $fh "\n\n"; + print $fh "\n
\n\n"; - # Print the TOC frame: - my @lines = @this_page_toc; - # use default TOC if no custom lines have been generated - @lines = @default_toc if (not @lines); - if (@lines) { - print $fh "\n\n
"; - print $fh '

' . $Texi2HTML::NAME{'Contents'} . "

\n"; - foreach my $line (@lines) { - print $fh $line; - } - print $fh "
"; - @this_page_toc = (); - } + # Print the TOC frame and reset the TOC: + lilypond_print_toc_div ($fh, \@this_page_toc); + @this_page_toc = (); # Close the page: print $fh "\n\n"; -- 2.39.5