]> git.donarmstrong.com Git - lilypond.git/commitdiff
texi2html: Make layout work with IE, cleaner HTML output
authorReinhold Kainhofer <reinhold@kainhofer.com>
Wed, 23 Jul 2008 14:13:21 +0000 (16:13 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Wed, 23 Jul 2008 14:17:28 +0000 (16:17 +0200)
-) Wrap <div id="main"> 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" <pnorcks@gmail.com> for the trickery with IE
CSS problems!

Documentation/lilypond-ie-fixes.css
Documentation/lilypond.css
lilypond-texi2html.init

index 0a273955196a9c02294c232aa71d4146687c97d3..8a068900f0750f82f267d540d7576e91d8416444 100644 (file)
@@ -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%;
+}  
index d64640180351cfb7a9a7b2b2d7e72e6526fc2181..f82b6d8cf8a1c532c8b4e08f9cc6d49721537eb7 100644 (file)
@@ -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;
 }
 
 
index e2d69c7390df2b6d11eabea8fa2a4a00d0e15766..048a7f33d0a8d142ce62ea53f480d636b5981d2c 100644 (file)
@@ -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 <div id="main">
+###           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<ul$NO_BULLET_LIST_ATTRIBUTE>");
+      push (@result, "\n$ind<ul$NO_BULLET_LIST_ATTRIBUTE>\n");
       push (@result, @child_result);
       push (@result, "$ind</ul></li>\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 = ("<div class=\"contents\">", "<ul$NO_BULLET_LIST_ATTRIBUTE>");
+    my @toc_entries = ("<div class=\"contents\">\n", "<ul$NO_BULLET_LIST_ATTRIBUTE>\n");
     my $children = $current_element->{'section_childs'};
     foreach ( @$children ) {
       push (@toc_entries, generate_ly_toc_entries($_, \%parentelements, $page_toc_depth, False));
     }
-    push (@toc_entries, "</ul>");
-    push (@toc_entries, "</div>");
+    push (@toc_entries, "</ul>\n");
+    push (@toc_entries, "</div>\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<div id=\"tocframe\">\n";
+    print $fh '<h4> ' . $Texi2HTML::NAME{'Contents'}  . "</h4>\n";
+    foreach my $line (@lines) {
+      print $fh $line;
+    }
+    print $fh "</div>\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 <div> at the beginning of the page
+sub lilypond_print_page_head($)
+{
+    my $fh = shift;
+    T2H_DEFAULT_print_page_head($fh);
+    print $fh "<div id=\"main\">\n";
+}
 
 # Print out the TOC in a <div> 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 "<p><font size='-1'>$program_string</font><br>$PRE_BODY_CLOSE</p>\n";
+  print $fh "<!-- FOOTER -->\n\n";
+  print $fh "<!-- end div#main here -->\n</div>\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<div id=\"tocframe\">";
-    print $fh '<h4> ' . $Texi2HTML::NAME{'Contents'}  . "</h4>\n";
-    foreach my $line (@lines) {
-      print $fh $line;
-    }
-    print $fh "</div>";
-    @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 "</body>\n</html>\n";