]> git.donarmstrong.com Git - lilypond.git/commitdiff
Texi2html: Set the TOC depth using a command-handler
authorReinhold Kainhofer <reinhold@kainhofer.com>
Mon, 30 Mar 2009 14:31:19 +0000 (16:31 +0200)
committerPatrick McCarty <pnorcks@gmail.com>
Fri, 17 Jul 2009 09:11:20 +0000 (02:11 -0700)
It seems that command_handler_process is the correct command handler
to set the TOC depth (after parsing all input files, but before any
possible output or TOC is created), depending on the texinfo variable
short_toc. This fixes my previous commit, where I had some workarounds,
because I didn't think of command_handler_process.
(cherry picked from commit 622f1ac10c57387050fdac2b095d6898f50faf2a)

lilypond-texi2html.init

index 1382e8c5a45997cc9be869b7c26305bae6f9da9c..a25f61847b1c5aa2755059297363010ae5f66e3e 100644 (file)
@@ -127,7 +127,6 @@ $Texi2HTML::Config::print_page_head      = \&lilypond_print_page_head;
 $Texi2HTML::Config::foot_line_and_ref  = \&makeinfo_like_foot_line_and_ref;
 $Texi2HTML::Config::foot_lines         = \&makeinfo_like_foot_lines;
 $Texi2HTML::Config::paragraph          = \&makeinfo_like_paragraph;
-$Texi2HTML::Config::init_out             = \&lilypond_init_out;
 
 
 
@@ -310,7 +309,7 @@ my $node_to_filename_map = ();
 # according to node titles, which works by simply overriding the id element of
 # the $element hash.
 # If an external nodename<=>filename/anchor map file is found (loaded in
-# lilypond_init_out, use the externally created values, otherwise use the
+# the command handler, use the externally created values, otherwise use the
 # same logic here.
 sub lilypond_element_file_name($$$)
 {
@@ -570,17 +569,10 @@ sub lilypond_init_toc_depth ()
     $page_toc_depth = 1;
   }
 }
-# We can't use a command-handler, because texinfo variables are not yet 
-# available at that stage:
-# push @Texi2HTML::Config::command_handler_init, \&lilypond_init_toc_depth;
+# Set the TOC-depth (depending on a texinfo variable short_toc) in a 
+# command-handler, so we have them available when creating the pages
+push @Texi2HTML::Config::command_handler_process, \&lilypond_init_toc_depth;
 
-# Initialize the toc_depth to 1 if the command-line option -D=short_toc is given
-sub lilypond_init_out()
-{
-  my $rval = t2h_default_init_out();
-  lilypond_init_toc_depth ();
-  return $rval;
-}
 
 # recursively generate the TOC entries for the element and its children (which
 # are only shown up to maxlevel. All ancestors of the current element are also
@@ -726,9 +718,6 @@ sub lilypond_print_element_header
 sub lilypond_toc_body($)
 {
     my $elements_list = shift;
-    # Workaround: Initialize the toc-depth here, because init_out is called
-    # only later in texi2html 1.83
-    lilypond_init_toc_depth ();
     # Generate a default TOC for pages without THIS_ELEMENT
     @default_toc = lilypond_generate_page_toc_body(@$elements_list[0]);
     return T2H_GPL_toc_body($elements_list);