]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
New solution to the "Someone stuck a colon in that filename!" problem:
authorFred Drake <fdrake@acm.org>
Tue, 29 May 2001 19:53:46 +0000 (19:53 +0000)
committerFred Drake <fdrake@acm.org>
Tue, 29 May 2001 19:53:46 +0000 (19:53 +0000)
Allow colons in the labels used for internal references, but do not
expose them when generating filename.

Doc/tools/node2label.pl

index f8bc1a68e6bf2f51764a05b696e358436a2324c8..69f396a2ad8d18074a3561fdca2a5ec8b1793c25 100755 (executable)
@@ -10,9 +10,16 @@ require "labels.pl";
 my $key;
 # sort so that we get a consistent assignment for nodes with multiple labels 
 foreach $label (sort keys %external_labels) {
-  $key = $external_labels{$label};
-  $key =~ s|^/||;
-  $nodes{$key} = $label;
+  #
+  # If the label can't be used as a filename on non-Unix platforms,
+  # skip it.  Such labels may be used internally within the documentation,
+  # but will never be used for filename generation.
+  #
+  if ($label =~ /^([-.a-zA-Z0-9]+)$/) {
+    $key = $external_labels{$label};
+    $key =~ s|^/||;
+    $nodes{$key} = $label;
+  }
 }
 
 # This adds the "internal" labels added for indexing.  These labels will not