| Perl6-Pod documentation | Contained in the Perl6-Pod distribution. |
:nested option on it:Perl6::Pod::Parser::NestedAttr - handle nested attribs
=begin para
We are all of us in the gutter,E<NL>
but some of us are looking at the stars!
=end para
=begin para :nested(2)
-- Oscar Wilde
=end para
:nested option on it: =begin para :nested
We are all of us in the gutter,E<NL>
but some of us are looking at the stars!
=end para
http://zag.ru/perl6-pod/S26.html, Perldoc Pod to HTML converter: http://zag.ru/perl6-pod/, Perl6::Pod::Lib
Zahatski Aliaksandr, <zag@cpan.org>
Copyright (C) 2009-2011 by Zahatski Aliaksandr
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
| Perl6-Pod documentation | Contained in the Perl6-Pod distribution. |
#=============================================================================== # # DESCRIPTION: Do :nested(1) attr # # AUTHOR: Aliaksandr P. Zahatski, <zahatski@gmail.com> #=============================================================================== #$Id$ package Perl6::Pod::Parser::NestedAttr;
use strict; use warnings; use Data::Dumper; use Test::More; use base 'Perl6::Pod::Parser'; sub on_start_element { my $self = shift; my $el = shift; my $attr = $el->get_attr; my @res = ($el); if ( my $nested = $attr->{nested} ) { #get level ($nested) = @{ ref($nested) ? $nested : [$nested] }; #wrap contents to format codes unshift @res, $self->mk_start_element( $el->mk_block('blockquote') ) for ( 1 .. $nested ); } return \@res; } sub on_end_element { my $self = shift; my $el = shift; my $attr = $el->get_attr; my @res = ($el); if ( my $nested = $attr->{nested} ) { #get level ($nested) = @{ ref($nested) ? $nested : [$nested] }; #wrap contents to format codes push @res, $self->mk_end_element( $el->mk_block('blockquote') ) for ( 1 .. $nested ); } return \@res; } 1; __END__