X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fpod2man.PL;h=6821d84334e8ee76a2e030991755f8e3c0ee6ef2;hb=a9bc755754f0db5e848e65dfd2e63a96af50ffd4;hp=a4a3c25eebe04038889f76d2e7919e710b06d4f5;hpb=e52f39a2da9ded67c5b268b2013619140e55f0c6;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/pod2man.PL b/pod/pod2man.PL index a4a3c25..6821d84 100644 --- a/pod/pod2man.PL +++ b/pod/pod2man.PL @@ -15,7 +15,7 @@ use File::Basename qw(&basename &dirname); chdir(dirname($0)); ($file = basename($0)) =~ s/\.PL$//; $file =~ s/\.pl$// - if ($^O eq 'VMS' or $^O eq 'os2'); # "case-forgiving" + if ($^O eq 'VMS' or $^O eq 'os2' or $^O eq 'amigaos'); # "case-forgiving" open OUT,">$file" or die "Can't create $file: $!"; @@ -25,14 +25,14 @@ 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 "$@"' - if 0; =head1 NAME @@ -388,8 +388,11 @@ $wanna_see{SYNOPSIS}++ if $section =~ /^3/; $name = @ARGV ? $ARGV[0] : ""; $Filename = $name; -$name = uc($name) if $section =~ /^1/; -$name =~ s/\.[^.]*$//; +if ($section =~ /^1/) { + require File::Basename; + $name = uc File::Basename::basename($name); +} +$name =~ s/\.(pod|p[lm])$//i; $name =~ s(/)(::)g; # translate Getopt/Long to Getopt::Long, etc. if ($name ne 'something') { @@ -605,11 +608,22 @@ END $indent = 0; +$begun = ""; + while (<>) { if ($cutting) { next unless /^=/; $cutting = 0; } + if ($begun) { + if (/^=end\s+$begun/) { + $begun = ""; + } + elsif ($begun =~ /^(roff|man)$/) { + print STDOUT $_; + } + next; + } chomp; # Translate verbatim paragraph @@ -634,6 +648,22 @@ while (<>) { $verbatim = 0; + if (/^=for\s+(\S+)\s*/s) { + if ($1 eq "man" or $1 eq "roff") { + print STDOUT $',"\n\n"; + } else { + # ignore unknown for + } + next; + } + elsif (/^=begin\s+(\S+)\s*/s) { + $begun = $1; + if ($1 eq "man" or $1 eq "roff") { + print STDOUT $'."\n\n"; + } + next; + } + # check for things that'll hosed our noremap scheme; affects $_ init_noremap();