1 #============================================================= -*-Perl-*-
6 # Pod view of a Pod Object Model.
9 # Andy Wardley <abw@kfs.org>
12 # Copyright (C) 2000 Andy Wardley. All Rights Reserved.
14 # This module is free software; you can redistribute it and/or
15 # modify it under the same terms as Perl itself.
18 # $Id: Pod.pm 77 2009-08-20 20:44:14Z ford $
20 #========================================================================
22 package BASIS::Pod::POM::View::Pod;
27 use BASIS::Pod::POM::Nodes;
28 use BASIS::Pod::POM::View;
29 use parent qw( BASIS::Pod::POM::View );
30 use vars qw( $VERSION $DEBUG $ERROR $AUTOLOAD $MARKUP );
32 $VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
33 $DEBUG = 0 unless defined $DEBUG;
35 # create reverse lookup table mapping method name to original sequence
37 map { ( $BASIS::Pod::POM::Node::Sequence::NAME{ $_ } => $_ ) }
38 keys %BASIS::Pod::POM::Node::Sequence::NAME,
43 my ($self, $type, $item) = @_;
45 # my ($pkg, $file, $line) = caller;
46 # print STDERR "called view ($type) from $file line $line\n";
48 if ($type =~ s/^seq_//) {
49 if ($type eq 'text') {
52 if ($type = $MARKUP->{ $type }) {
53 if ($item =~ /[<>]/) {
54 return "$type<< $item >>";
57 return "$type<$item>";
61 elsif (ref $item eq 'HASH') {
62 if (defined $item->{ content }) {
63 return $item->{ content }->present($self);
65 elsif (defined $item->{ text }) {
66 my $text = $item->{ text };
67 return ref $text ? $text->present($self) : $text;
83 my ($self, $pod) = @_;
84 # return "=pod\n\n" . $pod->content->present($self) . "=cut\n\n";
85 return $pod->content->present($self);
90 my ($self, $head1) = @_;
92 . $head1->title->present($self)
94 . $head1->content->present($self);
99 my ($self, $head2) = @_;
101 . $head2->title->present($self)
103 . $head2->content->present($self);
108 my ($self, $head3) = @_;
110 . $head3->title->present($self)
112 . $head3->content->present($self);
117 my ($self, $head4) = @_;
119 . $head4->title->present($self)
121 . $head4->content->present($self);
126 my ($self, $over) = @_;
130 . $over->content->present($self)
136 my ($self, $item) = @_;
138 my $title = $item->title();
139 $title = $title->present($self) if ref $title;
140 return "=item $title\n\n"
141 . $item->content->present($self);
146 my ($self, $for) = @_;
151 . $for->content->present($self);
156 my ($self, $begin) = @_;
160 . $begin->content->present($self)
168 my ($self, $text) = @_;
174 my ($self, $text) = @_;
180 my ($self, $meta) = @_;
184 . $meta->content->present($self)
197 Pod view of a Pod Object Model.
203 =item C<view($self, $type, $item)>
205 =item C<view_pod($self, $pod)>
207 =item C<view_head1($self, $head1)>
209 =item C<view_head2($self, $head2)>
211 =item C<view_head3($self, $head3)>
213 =item C<view_head4($self, $head4)>
215 =item C<view_over($self, $over)>
217 =item C<view_item($self, $item)>
219 =item C<view_for($self, $for)>
221 =item C<view_begin($self, $begin)>
223 =item C<view_textblock($self, $textblock)>
225 =item C<view_verbatim($self, $verbatim)>
227 =item C<view_meta($self, $meta)>
233 Andy Wardley E<lt>abw@kfs.orgE<gt>
235 =head1 COPYRIGHT AND LICENSE
237 Copyright (C) 2000 Andy Wardley. All Rights Reserved.
239 This module is free software; you can redistribute it and/or
240 modify it under the same terms as Perl itself.