X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Documentation%2Flilypond-texi2html.init;h=4ca2a63fae48c8405e1212f654f002984db1f684;hb=1cbd558eea13d742beae758fb6031a630a84ae07;hp=d6006a8099413f8f7c00fa551a9c3b0f5223e6aa;hpb=66a442073ffd297a93cfb398587f7b66d66094a7;p=lilypond.git diff --git a/Documentation/lilypond-texi2html.init b/Documentation/lilypond-texi2html.init index d6006a8099..4ca2a63fae 100644 --- a/Documentation/lilypond-texi2html.init +++ b/Documentation/lilypond-texi2html.init @@ -381,17 +381,7 @@ sub ly_get_string () { ### FUNCTIONALITY FOR MAIN WEB PAGES ############################################################################# -my $web_manual = 0; -sub lilypond_init_web_manual () -{ - if (exists($main::value{'web_manual'})) - { - print STDERR "Initializing settings for web site\n"; - $web_manual = 1; - web_settings(); - } -} -push @Texi2HTML::Config::command_handler_process, \&lilypond_init_web_manual; +our $web_manual; ############################################################################# ### SETTINGS FOR TEXI2HTML @@ -400,21 +390,28 @@ push @Texi2HTML::Config::command_handler_process, \&lilypond_init_web_manual; # Validation fix for texi2html<=1.82 $Texi2HTML::Config::DOCTYPE = ''; -sub web_settings() { - if ($web_manual) { - @Texi2HTML::Config::CSS_REFS = ( - {FILENAME => "lilypond-web.css", TITLE => "Default style"} - ); - } else { - @Texi2HTML::Config::CSS_REFS = ( - {FILENAME => "lilypond-mccarty.css", TITLE => "Patrick McCarty's design"} +@Texi2HTML::Config::CSS_REFS = ( + {FILENAME => "lilypond-mccarty.css", TITLE => "Default style"} ); - } -} @Texi2HTML::Config::ALT_CSS_REFS = ( {FILENAME => "lilypond.css", TITLE => "Andrew Hawryluk's design" }, {FILENAME => "lilypond-blue.css", TITLE => "Kurt Kroon's blue design" }, ); + +sub web_settings() { + print STDERR "Initializing settings for web site\n"; + $Texi2HTML::Config::BODYTEXT = ""; + @Texi2HTML::Config::CSS_REFS = ( + {FILENAME => "lilypond-web.css", TITLE => "Patrick McCarty's design"} + ); + @Texi2HTML::Config::ALT_CSS_REFS = ( + {FILENAME => "lilypond-web-alt1.css", TITLE => "Alternate style 1"}, + {FILENAME => "lilypond-web-alt2.css", TITLE => "Alternate style 2"}, + ); +} + +# web_settings() if (exists($main::value{'web_manual'})); + $Texi2HTML::Config::USE_ACCESSKEY = 1; $Texi2HTML::Config::USE_LINKS = 1; $Texi2HTML::Config::USE_REL_REV = 1; @@ -422,7 +419,7 @@ $Texi2HTML::Config::SPLIT_INDEX = 0; $Texi2HTML::Config::SEPARATED_FOOTNOTES = 0; # Print footnotes on same page, not separated if ($Texi2HTML::Config::SPLIT eq 'section' or - $Texi2HTML::Config::SPLIT eq 'subsubsection') { + $Texi2HTML::Config::SPLIT eq 'node') { $Texi2HTML::Config::element_file_name = \&lilypond_element_file_name; } @@ -538,17 +535,20 @@ sub load_map_file ($) # '<:encoding(utf8)', but decoding from UTF-8 line by line works. -jm if (open(XREFFILE,'<', $mapfile)) { my $line; + # print STDERR "*** PRINTING MAP FILE LINES ***\n"; while ( $line = decode ('UTF-8', ) ) { # parse the tab-separated entries and insert them into the map: chomp($line); my @entries = split(/\t/, $line); if (scalar (@entries) == 3) { $node_map->{$entries[0]} = [$entries[1], $entries[2]]; + $, = " "; + # print STDERR @entries; + # print STDERR "\n"; } else { print STDERR "Invalid entry in the node file $mapfile: $line\n"; } } - # print STDERR %{$node_map}; close (XREFFILE); } else { print STDERR "WARNING: Unable to load the map file $mapfile\n"; @@ -656,10 +656,12 @@ sub lilypond_element_file_name($$$) 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)); + $filename = lc($filename); # unnumbered sections (except those at top-level!) always go to the same # file as the previous numbered section - if (not ($element->{number}) and not ($lastfilename eq '') and ($element->{level} > 1)) { + if (not $docu_name == "web" and not ($element->{number}) + and not ($lastfilename eq '') and ($element->{level} > 1)) { $filename = $lastfilename; } if (($filename eq $lastfilename)) { @@ -669,8 +671,8 @@ sub lilypond_element_file_name($$$) $$element{doc_nr} = $docnr; $lastfilename = $filename; } - # print STDERR "File name: $filename\n"; - return lc($filename); + print STDERR "Output file name: $filename\n"; + return $filename; } elsif ($type eq "top" or $type eq "toc" or $type eq "doc" or $type eq "stoc" or $type eq "foot" or $type eq "about") { return; @@ -688,15 +690,17 @@ sub lilypond_element_file_name($$$) } my $filename = texinfo_file_name($node_name); $filename .= ".$docu_ext" if (defined($docu_ext)); + $filename = lc($filename); $docnr += 1; $$element{doc_nr} = $docnr; $lastfilename = $filename; print STDERR "File name: $filename\n"; - return lc($filename); + return $filename; } else { $$element{doc_nr} = $docnr; + $filename = lc ($filename); print STDERR "File name: $filename\n"; - return lc($filename); + return $filename; } } @@ -743,6 +747,10 @@ sub lilypond_init_map () my $map_filename = main::locate_include_file ("${docu_name}.$Texi2HTML::THISDOC{current_lang}.xref-map") || main::locate_include_file ("${docu_name}.xref-map"); print STDERR "Map filename is: $map_filename\nDocu name is $docu_name\n"; + if ($docu_name eq 'web') { + $web_manual = 1; + web_settings(); + } $node_to_filename_map = load_map_file ($map_filename); } push @Texi2HTML::Config::command_handler_init, \&lilypond_init_map; @@ -888,7 +896,8 @@ my @default_toc = []; # Initialize the toc_depth to 1 if the command-line option -D=short_toc is given sub lilypond_init_toc_depth () { - if (exists($main::value{'short_toc'}) and not exists($main::value{'bigpage'})) { + if (exists($main::value{'short_toc'}) and not exists($main::value{'bigpage'}) + and not $web_manual) { $page_toc_depth = 1; } } @@ -897,6 +906,7 @@ sub lilypond_init_toc_depth () push @Texi2HTML::Config::command_handler_process, \&lilypond_init_toc_depth; + # 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 # shown with their immediate children, irrespective of their level. @@ -998,9 +1008,8 @@ sub generate_ly_toc_entries($$$) push (@result, "\n$ind\n"); if ($web_manual) { push (@result, "$ind" . &$anchor ($element->{'tocid'}, "$element->{'file'}#$element->{'target'}","(main)")); - } else { - push (@result, @child_result); } + push (@result, @child_result); push (@result, "$ind\n"); } } @@ -1034,7 +1043,7 @@ sub lilypond_generate_page_toc_body($) # Create the toc entries recursively my @toc_entries = ""; if ($web_manual) { - push (@toc_entries, "\n"); + @toc_entries = "\n"; # FIXME: add link to main page, really hackily. if ($element->{'sectionup'}) { # it's not the top element @@ -1051,11 +1060,11 @@ sub lilypond_generate_page_toc_body($) push (@toc_entries, generate_ly_toc_entries($_, \%parentelements, $page_toc_depth)); } # search box - if ($web_manual) { + if ($sergsmoeivjriohuemf) { # WTF, perl needs 6 lines of magic to do: ' ' + open ('file-name').read ()? local $/=undef; my $name = "search-box.html"; - open FILE, "$ENV{SRC_DIR}/$name" or open FILE, "$ENV{SRC_DIR}/../$name" or die die "no such file: $name: $!"; + open FILE, "$ENV{SRC_DIR}/$name" or open FILE, "$ENV{SRC_DIR}/../$name" or die "no such file: $name: $!"; my $string = ; $string = "
  • \n" . $string . "
  • \n"; @@ -1063,7 +1072,11 @@ sub lilypond_generate_page_toc_body($) close FILE; } push (@toc_entries, "\n"); - push (@toc_entries, "\n"); + if ($web_manual) { + push (@toc_entries, "\n"); + } else { + push (@toc_entries, "\n"); + } return @toc_entries; } @@ -1093,8 +1106,7 @@ sub lilypond_print_toc_div ($$) $reldir = "../" if ($Texi2HTML::Config::SPLIT eq 'section'); my $uplink = $reldir."web/manuals.${lang}html"; - if ($web_manual) { - } else { + if (not $web_manual) { print $fh "

    << " . &ly_get_string ('Back to Documentation Index') . @@ -1515,13 +1527,10 @@ sub makeinfo_like_paragraph ($$$$$$$$$$$$$) ############################################################################# # For split pages, use index.html as start page! -if ($Texi2HTML::Config::SPLIT eq 'section') { +if ($Texi2HTML::Config::SPLIT eq 'section' or + $Texi2HTML::Config::SPLIT eq 'node') { $Texi2HTML::Config::TOP_FILE = 'index.html'; } -if ($web_node) { -} else { - push @Texi2HTML::Config::command_handler_process, \&lilypond_init_toc_depth; -} return 1;