]> git.donarmstrong.com Git - lilypond.git/commitdiff
Web build: remove some unneeded # html links.
authorGraham Percival <graham@percival-music.ca>
Fri, 22 Jan 2010 19:47:16 +0000 (19:47 +0000)
committerGraham Percival <graham@percival-music.ca>
Fri, 22 Jan 2010 19:47:16 +0000 (19:47 +0000)
Unfortunately this only applies to external_href, so the website
TOC is still broken.  But at least it's a step in the right
direction.

Documentation/lilypond-texi2html.init

index 9fb7e4096cffdf9551e31873184bbd206d18dbe4..bfd88624a36388e920747ec43392687caf28d90a 100644 (file)
@@ -976,8 +976,6 @@ sub lilypond_unknown($$$$$)
 }
 
 
-
-
 my %translated_books = ();
 # Construct a href to an external source of information.
 # node is the node with texinfo @-commands
@@ -1023,13 +1021,32 @@ sub lilypond_external_href($$$)
   }
 
   if (defined $file) {
-    return &$default_external_href($node, $node_id, $node_hxmlt_id, lc($file));
+    $href = &$default_external_href($node, $node_id, $node_hxmlt_id, lc($file));
+    remove_unneeded_anchor($href);
+    return $href;
   } else {
-    return &$default_external_href($node, $node_id, $node_hxmlt_id);
+    $href = &$default_external_href($node, $node_id, $node_hxmlt_id);
+    remove_unneeded_anchor($href);
+    return $href;
   }
 }
 
-
+sub remove_unneeded_anchor($)
+{
+  my $ref = shift;
+  my @hrefsplit = split("/", $href);
+  for ($i = 0; $i < @hrefsplit; $i++) {
+    $item = @hrefsplit[$i];
+    if ($item =~ /#/) {
+      @splitted = split("#", $item);
+      if (@splitted[0] == @splitted[1]) {
+        @hrefsplit[$i] = @splitted[0]
+      }
+    }
+  }
+  $href = join("/", @hrefsplit);
+  return $href
+}