From 946ce32f1a805250d975444928b950a26a0215ac Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Tue, 5 Aug 2008 21:05:03 +0200 Subject: [PATCH] texi2html: Fix issues with snippets page, fix coding errors -) use eq instead of == for string comparisons -) unnumberedsec (snippets!) don't need an entry in the map file (they should have one, but I don't write out a warning, because with snippets it just doesn't work otherwise: A snippet can be in multiple sections, so I cannot use the snippet name to look up the proper file in the hash. For this reason, I don't handle snippets snippets at all with my extract_texi_filename.py script and instead let the .init file fall back to the default of putting all unnumbered sections into the previous file). --- lilypond-texi2html.init | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lilypond-texi2html.init b/lilypond-texi2html.init index fbabdcf431..a7eaf9d17f 100644 --- a/lilypond-texi2html.init +++ b/lilypond-texi2html.init @@ -260,11 +260,17 @@ sub split_at_numbered_sections($$$) $node_name = main::remove_texi($element->{'texi'}); } + # If we have an entry in the section<=>filename map, use that one, otherwise + # generate the filename/anchor here. In the latter case, external manuals + # will not be able to retrieve the file name for xrefs!!! Still, I already + # had that code, so I'll leave it in in case something goes wrong with the + # extract_texi_filenames.py script in the lilypond build process! 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)); + $element->{id} = $anchor; - if ($filename == $lastfilename) { + if ($filename eq $lastfilename) { $$element{doc_nr} = $docnr; } else { $docnr += 1; @@ -278,23 +284,17 @@ sub split_at_numbered_sections($$$) return; } else { print STDERR "WARNING: Node '$node_name' was NOT found in the map\n" - unless $node_name eq ''; - # If we have an entry in the section<=>filename map, use that one, otherwise - # generate the filename/anchor here. In the latter case, external manuals - # will not be able to retrieve the file name for xrefs!!! Still, I already - # had that code, so I'll leave it in in case something goes wrong with the - #extract_texi_filenames.py script in the lilypond build process! - # TODO: lookup node name in nodename<=>filename map + unless ($node_name eq '') or ($element->{'tag'} eq 'unnumberedsec'); # derive the name of the anchor (i.e. the part after # in the links!), # don't use texi2html's SECx.x default! - my $sec_name = main::remove_texi($element->{'texi'}); - if ($element->{'node_ref'}->{'texi'} ne '') { # if we have a node, use its name: + # if we have a node, use its name: + if ($element->{'node_ref'}->{'texi'} ne '') { $sec_name = main::remove_texi($element->{'node_ref'}->{'texi'}); } my $anchor = $sec_name; - if ($$element{translationof}) { + if ($element->{translationof}) { $anchor = main::remove_texi($$element{translationof}); } # normalize to the same file name as texinfo @@ -385,7 +385,7 @@ sub lilypond_unknown($$$$$) # necessary here at all. Still, I'll leave the code in just in case the # python script messed up ;-) if ($pass == 1 and $macro eq "translationof") { - if (ref($state->{'element'})=='HASH') { + if (ref($state->{'element'}) eq 'HASH') { $state->{'element'}->{'translationof'} = main::normalise_space($line); } return ('', true, undef, undef); @@ -817,7 +817,7 @@ sub lilypond_print_navigation ############################################################################# # For split pages, use index.html as start page! -if ($Texi2HTML::Config::SPLIT == 'section') { +if ($Texi2HTML::Config::SPLIT eq 'section') { $Texi2HTML::Config::TOP_FILE = 'index.html'; } -- 2.39.5