]> git.donarmstrong.com Git - lilypond.git/commitdiff
texi2html: Fix displayed text for external refs
authorReinhold Kainhofer <reinhold@kainhofer.com>
Mon, 11 Aug 2008 18:32:45 +0000 (20:32 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Mon, 11 Aug 2008 18:32:45 +0000 (20:32 +0200)
lilypond-texi2html.init

index 0849c041d11e34b231a714f8e72d3adfa90f389f..2483e0f20151695b02f68263b518822b267b8f44 100644 (file)
@@ -352,9 +352,22 @@ sub lilypond_external_ref($$$$$$)
   my $href = shift;
   my $cross_ref = shift;
 
-  $file_node =~ s/\(.*\)//;
-  $file_node = &$anchor('', $href, $file_node) if ($file_node ne '');
-  return &$I('%{node_file_href}', { 'node_file_href' => $file_node });
+  my $displaytext = '';
+
+  # 1) if we have a cross ref name, that's the text to be displayed:
+  # 2) For the top node, use the (printable) name of the manual, unless we 
+  #    have an explicit cross ref name
+  # 3) In all other cases use the section name
+  if ($cross_ref ne '') {
+    $displaytext = $cross_ref;
+  } elsif (($section eq '') or ($displaytext eq 'Top')) {
+    $displaytext = $book;
+  } else {
+    $displaytext = $section;
+  }
+
+  $displaytext = &$anchor('', $href, $displaytext) if ($displaytext ne '');
+  return &$I('%{node_file_href}', { 'node_file_href' => $displaytext });
 
 #  Default: format as "see <a ..>NODE</a> section 'SECTION' in BOOK". We don't want this!
 #   return t2h_default_external_ref($type, $section, $book, $file_node, $href, $cross_ref);