From 19e2ce58bf98640e8fdf009bbb2edef2ce1236ef Mon Sep 17 00:00:00 2001
From: Fred Drake <fdrake@acm.org>
Date: Fri, 27 Mar 1998 05:24:53 +0000
Subject: Add support for mapping internal labels used from the index.

---
 Doc/tools/node2label.pl | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/Doc/tools/node2label.pl b/Doc/tools/node2label.pl
index 3e4f8f0..5cc54d6 100755
--- a/Doc/tools/node2label.pl
+++ b/Doc/tools/node2label.pl
@@ -15,22 +15,33 @@ foreach $label (sort keys %external_labels) {
   $nodes{$key} = $label;
 }
 
+# This adds the "internal" labels added for indexing.  These labels will not
+# be used for file names.
+require "intlabels.pl";
+foreach $label (keys %internal_labels) {
+  $key = $internal_labels{$label};
+  $key =~ s|^/||;
+  if (defined($nodes{$key})) {
+    $nodes{$label} = $nodes{$key};
+  }
+}
+
 # collect labels that have been used
 %newnames = ();
 
 while (<>) {
   # don't want to do one s/// per line per node
   # so look for lines with hrefs, then do s/// on nodes present
-  if (/HREF=\"([^\#\"]*)html[\#\"]/) {
-    @parts = split(/HREF\=\"/);
+  if (/(HREF|href)=\"([^\#\"]*)html[\#\"]/) {
+    @parts = split(/(HREF|href)\=\"/);
     shift @parts;
     for $node (@parts) {
       $node =~ s/[\#\"].*$//g;
       chop($node);
       if (defined($nodes{$node})) {
 	$label = $nodes{$node};
-	if (s/HREF=\"$node([\#\"])/HREF=\"$label.html$1/g) {
-	  s/HREF=\"$label.html#SECTION\d+/HREF=\"$label.html/g;
+	if (s/(HREF|href)=\"$node([\#\"])/$1=\"$label.html$2/g) {
+	  s/(HREF|href)=\"$label.html#(l2h-)?SECTION\d+/$1=\"$label.html/g;
 	  $newnames{$node} = "$label.html";
 	}
       }
-- 
cgit v0.12

