From: Kenneth Albanowski Date: Fri, 20 Dec 1996 21:43:35 +0000 (-0500) Subject: Better support for =for X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8c634b6ed8dff69ce029df1386a301fb7f8b3062;p=p5sagit%2Fp5-mst-13.2.git Better support for =for private-msgid: --- diff --git a/lib/Pod/Text.pm b/lib/Pod/Text.pm index c431728..9d6636a 100644 --- a/lib/Pod/Text.pm +++ b/lib/Pod/Text.pm @@ -86,6 +86,7 @@ $cutting = 1; $DEF_INDENT = 4; $indent = $DEF_INDENT; $needspace = 0; +$begun = ""; open(IN, $file) || die "Couldn't open $file: $!"; @@ -94,6 +95,15 @@ POD_DIRECTIVE: while () { next unless /^=/; $cutting = 0; } + if ($begun) { + if (/^=end\s+$begun/) { + $begun = ""; + } + elsif ($begun eq "text") { + print STDOUT $_; + } + next; + } 1 while s{^(.*?)(\t+)(.*)$}{ $1 . (' ' x (length($2) * 8 - length($1) % 8)) @@ -106,6 +116,22 @@ POD_DIRECTIVE: while () { next; } + if (/^=for\s+(\S+)\s*/s) { + if ($1 eq "text") { + print STDOUT $',""; + } else { + # ignore unknown for + } + next; + } + elsif (/^=begin\s+(\S+)\s*/s) { + $begun = $1; + if ($1 eq "text") { + print STDOUT $'.""; + } + next; + } + sub prepare_for_output { s/\s*$/\n/; diff --git a/pod/pod2latex.PL b/pod/pod2latex.PL index ebace22..4f79c12 100644 --- a/pod/pod2latex.PL +++ b/pod/pod2latex.PL @@ -124,11 +124,21 @@ open(LATEX,">$pod.tex"); &do_hdr(); $cutting = 1; +$begun = ""; while () { if ($cutting) { next unless /^=/; $cutting = 0; } + if ($begun) { + if (/^=end\s+$begun/) { + $begun = ""; + } + elsif ($begun =~ /^(tex|latex)$/) { + print LATEX $_; + } + next; + } chop; length || (print LATEX "\n") && next; @@ -146,6 +156,22 @@ while () { next; } + if (/^=for\s+(\S+)\s*/s) { + if ($1 eq "tex" or $1 eq "latex") { + print LATEX $',"\n"; + } else { + # ignore unknown for + } + next; + } + elsif (/^=begin\s+(\S+)\s*/s) { + $begun = $1; + if ($1 eq "tex" or $1 eq "latex") { + print LATEX $'."\n"; + } + next; + } + # preserve '=item' line with pod quotes as they are. if (/^=item/) { ($bareitem = $_) =~ s/^=item\s*//; diff --git a/pod/pod2man.PL b/pod/pod2man.PL index 68121e4..6821d84 100644 --- a/pod/pod2man.PL +++ b/pod/pod2man.PL @@ -608,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 @@ -637,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();