Ticket #477: pod2html.patch
| File pod2html.patch, 2.1 KB (added by rg, 13 years ago) |
|---|
-
lib/Parrot/Docs/POD2HTML.pm
33 33 our $VERSION = '1.0'; 34 34 35 35 use Parrot::Docs::HTMLPage; 36 use Parrot::Distribution; 36 37 38 =item C<new()> 39 40 Extend C<Pod::Simple::HTML> method to accept PIR and PASM sections that 41 contain example code, which will be put into a <pre> HTML element. 42 43 =cut 44 45 sub new { 46 my $new = shift->SUPER::new(@_); 47 48 $new->accept_targets('PIR', 'PASM'); 49 delete(@{$new->{'Tagmap'}}{'Data','/Data'}); 50 51 return $new; 52 } 53 37 54 =item C<do_beginning()> 38 55 39 56 Reimplements the C<Pod::Simple::HTML> method to add a header to the start … … 125 142 elsif ( $tagname eq 'Data' ) { 126 143 $self->process_data_start_token($token); 127 144 } 145 elsif ( $tagname eq 'for' ) { 146 $self->process_for_start_token($token); 147 } 128 148 else { 129 149 $self->process_other_start_token($token); 130 150 } … … 312 332 return; 313 333 } 314 334 315 printf { $self->{'output_fh'} } "\n" . $next->text . "\n"; 335 if ($self->{IN_CODE_BLOCK}) { 336 print { $self->{'output_fh'} } $next->text; 337 } 338 else { 339 print { $self->{'output_fh'} } "\n" . $next->text . "\n"; 340 } 316 341 } 317 342 343 =item C<process_for_start_token($token)> 344 345 Processes a for start token. 346 347 =cut 348 349 sub process_for_start_token { 350 my $self = shift; 351 my $token = shift; 352 my $target = $token->attr("target"); 353 354 if ($target eq "PIR" || $target eq "PASM") { 355 print { $self->{'output_fh'} } "<pre>"; 356 $self->{IN_CODE_BLOCK} = 1; 357 } 358 } 359 318 360 =item C<process_other_start_token($token)> 319 361 320 362 Processes a start token not processable by the above methods. … … 368 410 elsif ( $tagname eq 'item-text' ) { 369 411 $self->{IN_ITEM_TEXT} = 0; 370 412 } 413 elsif ( $tagname eq 'for' ) { 414 print { $self->{'output_fh'} } '</pre>' if $self->{IN_CODE_BLOCK}; 415 $self->{IN_CODE_BLOCK} = 0; 416 } 371 417 372 418 print { $self->{'output_fh'} } $self->{'Tagmap'}{"/$tagname"} || return; 373 419
