From: Reinhold Kainhofer Date: Tue, 5 Aug 2008 18:55:13 +0000 (+0200) Subject: texi2html: handle big-page X-Git-Tag: release/2.11.58-1~32^2~87 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0b33d275df3d757b7327ca970b2fc0f71c47bf2c;p=lilypond.git texi2html: handle big-page For big-page files, we cannot simply load the map file with _xref.map attached, but rather have to remove the -big-page from the book name before. Everything else can stay the same. --- diff --git a/lilypond-texi2html.init b/lilypond-texi2html.init index 2d853fec5b..fbabdcf431 100644 --- a/lilypond-texi2html.init +++ b/lilypond-texi2html.init @@ -413,29 +413,34 @@ sub lilypond_external_href($$$) my $file = shift; my $original_func = \&t2h_default_external_href; - # TODO: # 1) Keep a hash of book->section_map - # 2) if not file in keys hash => try to load the map (assign empty map is non-existent => will load only once!) - # 3) if node in the section=>(file, anchor) map, replace node_id and node_xhtml_id by the map's values + # 2) if not file in keys hash => try to load the map (assign empty map if + # non-existent => will load only once!) + # 3) if node in the section=>(file, anchor) map, replace node_id and + # node_xhtml_id by the map's values # 4) call the t2h_default_external_href with these values (or the old ones if not found) -# print STDERR "lilypond_external_href: texi_node='$node', node_file='$node_id', node_xhtml_id='$node_xhtml_id', file='$file'\n"; + if (($node_id ne '') and defined($file)) { + my $map_name = $file; + $map_name =~ s/-big-page//; + # Load the map if we haven't done so already - if (!exists($translated_books{$file})) { + if (!exists($translated_books{$map_name})) { my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'}); - my $map_filename = "$docu_dir/${file}_xref.map"; - $translated_books{$file} = load_map_file ($map_filename); + my $map_filename = "$docu_dir/${map_name}_xref.map"; + $translated_books{$map_name} = load_map_file ($map_filename); } # look up translation. use these values instead of the old filename/anchor - my $section_name_map = $translated_books{$file}; + my $section_name_map = $translated_books{$map_name}; my $node_text = main::remove_texi($node); if (defined($section_name_map->{$node_text})) { - ($node_id, $node_hxmlt_id) = @{$section_name_map->{$node_text}}; + (my $node_id, $node_hxmlt_id) = @{$section_name_map->{$node_text}}; } else { - print STDERR "Unable to find key '$node_text' in section_name_map for book $file\n"; + print STDERR "Unable to find key '$node_text' in section_name_map for book $map_name\n"; } } + if (defined $file) { return &$original_func($node, $node_id, $node_hxmlt_id, $file); } else {