develooper Front page | perl.perl5.porters | Postings from November 2000

[PATCH] Fixing heading limitations in Pod::Man

Thread Next
From:
Casey R. Tweten
Date:
November 9, 2000 08:42
Subject:
[PATCH] Fixing heading limitations in Pod::Man
Message ID:
Pine.OSF.4.21.0011091139350.30702-100000@home.kiski.net
This patch will make and C<=head> greater than 2 act just like a level
2 heading.

*** lib/Pod/Man.pm.orig	Thu Nov  9 11:35:19 2000
--- lib/Pod/Man.pm	Thu Nov  9 11:35:50 2000
***************
*** 487,493 ****
      my $command = shift;
      return if $command eq 'pod';
     return if ($$self{EXCLUDE} && $command ne 'end');
!     if ($self->can ('cmd_' . $command)) {
          $command = 'cmd_' . $command;
          $self->$command (@_);
       } else {
--- 487,495 ----
      my $command = shift;
      return if $command eq 'pod';
     return if ($$self{EXCLUDE} && $command ne 'end');
!     if ( $command =~ /head\d+/ ) {
!       $self->cmd_head (@_);
!     } elsif ($self->can ('cmd_' . $command)) {
          $command = 'cmd_' . $command;
          $self->$command (@_);
       } else {
***************
*** 652,658 ****
  # in some versions of catman, so don't output a .IX for that section.  .SH
  # already uses small caps, so remove any E<> sequences that would cause
  # them.
! sub cmd_head1 {
      my $self = shift;
      local $_ = $self->parse (@_);
      s/\s+$//;
--- 654,662 ----
  # in some versions of catman, so don't output a .IX for that section.  .SH
  # already uses small caps, so remove any E<> sequences that would cause
  # them.
! 
! # This now handles all heading levels so we aren't limited to two.
! sub cmd_head {
      my $self = shift;
      local $_ = $self->parse (@_);
      s/\s+$//;
***************
*** 662,684 ****
          $self->output (".PD\n");
      }
      $self->output (switchquotes ('.SH', $self->mapfonts ($_)));
-     $self->outindex (($_ eq 'NAME') ? () : ('Header', $_));
-     $$self{NEEDSPACE} = 0;
- }
  
! # Second level heading.
! sub cmd_head2 {
!     my $self = shift;
!     local $_ = $self->parse (@_);
!     s/\s+$//;
!     if ($$self{ITEMS} > 1) {
!         $$self{ITEMS} = 0;
!         $self->output (".PD\n");
      }
-     $self->output (switchquotes ('.Sh', $self->mapfonts ($_)));
-     $self->outindex ('Subsection', $_);
      $$self{NEEDSPACE} = 0;
  }
  
  # Start a list.  For indents after the first, wrap the outside indent in .RS
  # so that hanging paragraph tags will be correct.
--- 666,680 ----
          $self->output (".PD\n");
      }
      $self->output (switchquotes ('.SH', $self->mapfonts ($_)));
  
!     if ( $_[2]->{-name} eq 'head1' ) {
!         $self->outindex (($_ eq 'NAME') ? () : ('Header', $_));
!     } else {
!         $self->outindex ('Subsection', $_);
      }
      $$self{NEEDSPACE} = 0;
  }
+ 
  
  # Start a list.  For indents after the first, wrap the outside indent in .RS
  # so that hanging paragraph tags will be correct.

-- 
print(join(' ', qw(Casey R. Tweten)));my $sig={mail=>'crt@kiski.net',site=>
'http://home.kiski.net/~crt'};print "\n",'.'x(length($sig->{site})+6),"\n";
print map{$_.': '.$sig->{$_}."\n"}sort{$sig->{$a}cmp$sig->{$b}}keys%{$sig};
my $VERSION = '0.01'; #'patched' by Jerrad Pierce <belg4mit at MIT dot EDU>


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About