perlbug.pod for 5.004
[p5sagit/p5-mst-13.2.git] / pod / pod2html.PL
index ced8478..602a866 100644 (file)
@@ -12,10 +12,9 @@ use File::Basename qw(&basename &dirname);
 
 # This forces PL files to create target in same directory as PL file.
 # This is so that make depend always knows where to find PL derivatives.
-chdir(dirname($0));
-($file = basename($0)) =~ s/\.PL$//;
-$file =~ s/\.pl$//
-       if ($^O eq 'VMS' or $^O eq 'os2');  # "case-forgiving"
+chdir dirname($0);
+$file = basename($0, '.PL');
+$file .= '.com' if $^O eq 'VMS';
 
 open OUT,">$file" or die "Can't create $file: $!";
 
@@ -25,14 +24,15 @@ print "Extracting $file (with variable substitutions)\n";
 # You can use $Config{...} to use Configure variables.
 
 print OUT <<"!GROK!THIS!";
-$Config{'startperl'}
+$Config{startperl}
+    eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
+       if \$running_under_some_shell;
 !GROK!THIS!
 
 # In the following, perl variables are not expanded during extraction.
 
 print OUT <<'!NO!SUBS!';
-eval 'exec perl -S $0 ${1+"$@"}'
-        if $running_under_some_shell;
+
 #
 # pod2html - convert pod format to html
 # Version 1.15
@@ -118,8 +118,9 @@ for $count (0,1) {
            open(HTML,">$html") || die "can't create $html: $ERRNO";
            print HTML '<!-- $Id$ -->',"\n",'<HTML><HEAD>',"\n";
            print HTML "<CENTER>" unless $NO_NS;
-           print HTML "<TITLE>$pod</TITLE>\n</HEAD>\n<BODY>";
+           print HTML "<TITLE>$pod</TITLE>";
            print HTML "</CENTER>" unless $NO_NS;
+           print HTML "\n</HEAD>\n<BODY>";
        }
        for ($i = 0; $i <= $#all; $i++) {       # decide what to do with each chunk
            $all[$i] =~ /^(\w+)\s*(.*)\n?([^\0]*)$/ ;
@@ -322,6 +323,7 @@ sub scan_thing{           # scan a chunk for later references
     my($cmd,$title,$pod) = @_;
     $_ = $title;
     s/\n$//;
+    s/E<(\d+)>/&#$1;/g;
     s/E<(.*?)>/&$1;/g;
     # remove any formatting information for the headers
     s/[SFCBI]<(.*?)>/$1/g;         
@@ -378,7 +380,7 @@ sub picrefs {
            } 
        } 
        if (length($key)) {
-            ($pod2,$num) = split(/_/,$value,2);
+            ($pod2, $num) = $value =~ /^(.*)_(\S+_\d+)$/;
            if ($htype eq "NAME") {  
                return "\n<A NAME=\"".$value."\">\n$bigkey</A>\n"
            }
@@ -501,11 +503,12 @@ sub gensym {
 sub pre_escapes {  # twiddle these, and stay up late  :-)
     my($thing) = @_;
     for ($$thing) { 
-    s/([\200-\377])/noremap("&".ord($1).";")/ge;
+    s/([\200-\377])/noremap("&#".ord($1).";")/ge;
        s/"(.*?)"/``$1''/gs;
        s/&/noremap("&amp;")/ge;
        s/<</noremap("&lt;&lt;")/eg;
        s/([^ESIBLCF])</$1\&lt\;/g;
+       s/E<(\d+)>/\&#$1\;/g;                     # embedded numeric special
        s/E<([^\/][^<>]*)>/\&$1\;/g;              # embedded special
     }
 }