Perl6::Pod::Block::pod - handle =pod block


Perl6-Pod documentation Contained in the Perl6-Pod distribution.

Index


Code Index:

NAME

Top

Perl6::Pod::Block::pod - handle =pod block

SYNOPSIS

Top

    =begin pod
    para
     code
    =end pod

DESCRIPTION

Top

=pod - cause the parser to remain in Pod mode

In =pod block:

* within a =pod ordinary paragraphs do not require an explicit marker or delimiters, but there is also an explicit para marker
* implicit code blocks may only be used within =pod, =item, =nested, =END, or semantic blocks.

SEE ALSO

Top

http://zag.ru/perl6-pod/S26.html, Perldoc Pod to HTML converter: http://zag.ru/perl6-pod/, Perl6::Pod::Lib

AUTHOR

Top

Zahatski Aliaksandr, <zag@cpan.org>

COPYRIGHT AND LICENSE

Top


Perl6-Pod documentation Contained in the Perl6-Pod distribution.
package Perl6::Pod::Block::pod;

#$Id$

use warnings;
use strict;
use Data::Dumper;
use Perl6::Pod::Block;
use base 'Perl6::Pod::Block';

sub new {
      my ( $class, %args ) = @_;
      my $self = $class->SUPER::new(%args, parent_context=>1);
}

sub on_para {
    my $self   = shift;
    my $parser = shift;
    my $txt    = shift;
    return unless defined $txt;

    #convert ordinary para to =para
    # and verbatim text to =code
    my $rparser = $self->context->{vars}->{root};

    #split para to ordinary and verbatim blocks
    foreach my $txt ( split /^\n/m, $txt ) {
        my $block_name = ( $txt =~ /^\s+/ ) ? 'code' : 'para';
        $rparser->start_block( $block_name, '', 666 );
        $rparser->para($txt);
        $rparser->end_block( $block_name, '', 666 );
    }
    return;
}

1;
__END__