Index: Documentation/lilypond-texi2html.init diff --git a/Documentation/lilypond-texi2html.init b/Documentation/lilypond-texi2html.init index 343847826b9ceaef32a9ddcb757cc535760fd708..134642a8b6c393d0dc25565a24db0666fa2840ee 100644 --- a/Documentation/lilypond-texi2html.init +++ b/Documentation/lilypond-texi2html.init @@ -583,9 +583,14 @@ $Texi2HTML::Config::USE_REL_REV = 1; $Texi2HTML::Config::SPLIT_INDEX = 0; $Texi2HTML::Config::SEPARATED_FOOTNOTES = 0; # Print footnotes on same page, not separated +my $bigpage = 0; +my $have_index_entries = 0; if ($Texi2HTML::Config::SPLIT eq 'section' or $Texi2HTML::Config::SPLIT eq 'node') { $Texi2HTML::Config::element_file_name = \&lilypond_element_file_name; + $bigpage = 0; +} else { + $bigpage = 1; } $Texi2HTML::Config::element_target_name = \&lilypond_element_target_name; @@ -789,6 +794,17 @@ sub lilypond_css_lines ($$) # docs still need this? -gp $Texi2HTML::THISDOC{'CSS_LINES'} .= "\n"; + + # Add the JavaScript file only if we have an index. + # Unfortunately, init_out is called after css_lines, so as a workaround + # here we have to check again for the existence of an index... + my $ix = main::get_index ("cp"); + $have_index_entries = (scalar $ix > 0); + my $reldir = ""; + $reldir = "../" unless $bigpage; + if ($have_index_entries) { + $Texi2HTML::THISDOC{'CSS_LINES'} .= "\n"; + } } @@ -1325,6 +1341,14 @@ sub lilypond_print_toc_div ($$) &ly_get_string ('Back to Documentation Index') . "
\n"; + # AJAX search box, written in JavaScript + if ($have_index_entries) { + my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'}); + print $fh '\n"; + } + print $fh '