summaryrefslogtreecommitdiff
path: root/pod/pod2man.PL
diff options
context:
space:
mode:
authorTim Bunce <Tim.Bunce@ig.co.uk>1997-06-11 12:00:00 +1200
committerTim Bunce <Tim.Bunce@ig.co.uk>1997-06-11 12:00:00 +1200
commit3e3baf6d63945cb64e829d6e5c70a7d00f3d3d03 (patch)
tree0143be655536dc428f4fa3cc7d01f6bcffe14c01 /pod/pod2man.PL
parent08aa1457cd52a368c210ab76a3da91cfadabea1a (diff)
parent3458556dd685b1767b760a72bd2e9007b5c4575e (diff)
downloadperl-3e3baf6d63945cb64e829d6e5c70a7d00f3d3d03.tar.gz
[differences between cumulative patch application and perl5.004_01]perl-5.004_01
[editor's note: The changes between this and 5.004 were processed from the m1t2 release, which was a bad idea as it was the _01 release which had the final corrected attributions. The differences between the various m*t* releases do that; I considered it most valuable just to look at the _NN releases. Many patches have been separated out and/or applied from the p5p archives nonetheless.]
Diffstat (limited to 'pod/pod2man.PL')
-rw-r--r--pod/pod2man.PL55
1 files changed, 51 insertions, 4 deletions
diff --git a/pod/pod2man.PL b/pod/pod2man.PL
index cd14ce2866..2c1837a37a 100644
--- a/pod/pod2man.PL
+++ b/pod/pod2man.PL
@@ -444,6 +444,7 @@ if ($name ne 'something') {
last FCHECK;
}
next if /^=cut\b/; # DB_File and Net::Ping have =cut before NAME
+ next if /^=pod\b/; # It is OK to have =pod before NAME
die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax;
}
die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax;
@@ -499,16 +500,36 @@ print <<"END";
.if (\\n(.H=4u)&(1m=20u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-8u'-\\" diablo 12 pitch
.ds L" ""
.ds R" ""
+''' \\*(M", \\*(S", \\*(N" and \\*(T" are the equivalent of
+''' \\*(L" and \\*(R", except that they are used on ".xx" lines,
+''' such as .IP and .SH, which do another additional levels of
+''' double-quote interpretation
+.ds M" """
+.ds S" """
+.ds N" """""
+.ds T" """""
.ds L' '
.ds R' '
+.ds M' '
+.ds S' '
+.ds N' '
+.ds T' '
'br\\}
.el\\{\\
.ds -- \\(em\\|
.tr \\*(Tr
.ds L" ``
.ds R" ''
+.ds M" ``
+.ds S" ''
+.ds N" ``
+.ds T" ''
.ds L' `
.ds R' '
+.ds M' `
+.ds S' '
+.ds N' `
+.ds T' '
.ds PI \\(*p
'br\\}
END
@@ -706,6 +727,10 @@ while (<>) {
# trofficate backslashes; must do it before what happens below
s/\\/noremap('\\e')/ge;
+# protect leading periods and quotes against *roff
+# mistaking them for directives
+s/^(?:[A-Z]<)?[.']/\\&$&/gm;
+
# first hide the escapes in case we need to
# intuit something and get it wrong due to fmting
@@ -833,8 +858,19 @@ while (<>) {
($Cmd, $_) = split(' ', $_, 2);
+ $dotlevel = 1;
+ if ($Cmd eq 'head1') {
+ $dotlevel = 1;
+ }
+ elsif ($Cmd eq 'head2') {
+ $dotlevel = 1;
+ }
+ elsif ($Cmd eq 'item') {
+ $dotlevel = 2;
+ }
+
if (defined $_) {
- &escapes;
+ &escapes($dotlevel);
s/"/""/g;
}
@@ -883,7 +919,7 @@ while (<>) {
if ($needspace) {
&makespace;
}
- &escapes;
+ &escapes(0);
clear_noremap(1);
print $_, "\n";
$needspace = 1;
@@ -915,6 +951,7 @@ sub nobreak {
}
sub escapes {
+ my $indot = shift;
s/X<(.*?)>/mkindex($1)/ge;
@@ -927,9 +964,19 @@ sub escapes {
s/([^"])--"/$1\\*(--"/g;
# fix up quotes; this is somewhat tricky
+ my $dotmacroL = 'L';
+ my $dotmacroR = 'R';
+ if ( $indot == 1 ) {
+ $dotmacroL = 'M';
+ $dotmacroR = 'S';
+ }
+ elsif ( $indot >= 2 ) {
+ $dotmacroL = 'N';
+ $dotmacroR = 'T';
+ }
if (!/""/) {
- s/(^|\s)(['"])/noremap("$1\\*(L$2")/ge;
- s/(['"])($|[\-\s,;\\!?.])/noremap("\\*(R$1$2")/ge;
+ s/(^|\s)(['"])/noremap("$1\\*($dotmacroL$2")/ge;
+ s/(['"])($|[\-\s,;\\!?.])/noremap("\\*($dotmacroR$1$2")/ge;
}
#s/(?!")(?:.)--(?!")(?:.)/\\*(--/g;