Browse files

Fixed various formatting errors

  • Loading branch information...
1 parent 78b45dd commit 0a819d6711455a2d2d477dd76269ef28447588f6 @jonallen committed May 16, 2010
View
29 lib/Perldoc/Convert/html.pm
@@ -161,8 +161,8 @@ sub view_over {
$strip = qr/^\s*\*\s*/;
} elsif ($first_title =~ /^\s*\d+\.?\s*/) {
# '=item 1.' or '=item 1 ' => <ol>
- $start = "<ol>\n";
- $end = "</ol>\n";
+ $start = "<dl>\n";
+ $end = "</dl>\n";
$strip = qr/^\s*\d+\.?\s*/;
} else {
$start = "<ul>\n";
@@ -186,15 +186,24 @@ sub view_item {
my $over = ref $self ? $self->{ OVER } : \@OVER;
my $title = $item->title();
my $strip = $over->[-1];
+ my $start_tag = '<li>';
+ my $end_tag = '</li>';
if (defined $title) {
$title = $title->present($self) if ref $title;
- $title =~ s/$strip// if $strip;
+ $title =~ s/($strip)// if $strip;
+ if (defined $1) {
+ my $dt = $1;
+ if ($dt =~ /^\d+\.?/) {
+ $start_tag = "<dt>$dt</dt><dd>";
+ $end_tag = "</dd>";
+ }
+ }
if (length $title) {
my $anchor = escape($item->title->present('Pod::POM::View::Text'));
$title = qq{<a name="$anchor"></a><b>$title</b>};
}
}
- return '<li>'."$title\n".$item->content->present($self)."</li>\n";
+ return $start_tag."$title\n".$item->content->present($self).$end_tag."\n";
}
@@ -232,10 +241,18 @@ sub view_seq_link {
return $link;
}
- $link =~ s!<code.*?>(.*?)</code>!$1!g;
- $link =~ s!<a.*?>(.*?)</a>!$1!g;
+ #$link =~ s!<code.*?>(.*?)</code>!$1!g;
+ #$link =~ s!<a.*?>(.*?)</a>!$1!g;
+
+ # Naively remove HTML tags from link text (tags screw up formatting...)
+ $link =~ s/<.*?>//sg;
my ($text,$inferred,$page,$section,$type) = parselink($link);
+
+ $inferred =~ s/"//sg if $inferred;
+ $section = decode_entities($section) if $section;
+ $section =~ s/^"(.*)"$/$1/ if $section;
+
#warn "$link at $document_name\n" if ($link =~ /perlvar\//);
#{
# no warnings 'uninitialized';
View
28 lib/Pod/POM.pm
@@ -13,12 +13,13 @@
#
# COPYRIGHT
# Copyright (C) 2000-2009 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
#
# This module is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# REVISION
-# $Id: POM.pm 71 2009-03-27 16:24:19Z ford $
+# $Id: POM.pm 88 2010-04-02 13:37:41Z ford $
#
#========================================================================
@@ -34,7 +35,7 @@ use Pod::POM::View::Pod;
use vars qw( $VERSION $DEBUG $ERROR $ROOT $TEXTSEQ $DEFAULT_VIEW );
use base qw( Exporter );
-$VERSION = '0.25';
+$VERSION = '0.27';
$DEBUG = 0 unless defined $DEBUG;
$ROOT = 'Pod::POM::Node::Pod'; # root node class
$TEXTSEQ = 'Pod::POM::Node::Sequence'; # text sequence class
@@ -174,6 +175,18 @@ sub parse_text {
$$line = 1;
$inpod = 0;
+ my @encchunks = split /^(=encoding.*)/m, $text;
+ $text = shift @encchunks;
+ while (@encchunks) {
+ my($encline,$chunk) = splice @encchunks, 0, 2;
+ require Encode;
+ my($encoding) = $encline =~ /^=encoding\s+(\S+)/;
+ Encode::from_to($chunk, $encoding, "utf8");
+ Encode::_utf8_on($chunk);
+ # $text .= "xxx$encline";
+ $text .= $chunk;
+ }
+
# patch from JJ
# while ($text =~ /(?:(.*?)(\n{2,}))|(.+$)/sg) {
while ($text =~ /(?:(.*?)((?:\s*\n){2,}))|(.+$)/sg) {
@@ -186,13 +199,6 @@ sub parse_text {
elsif ($type eq 'cut') { $inpod = 0; next }
else { $inpod = 1 };
- if ($self->{in_begin}) {
- unless ($type eq 'end') {
- $para = "$1$para";
- $type = "text";
- }
- }
-
if ($type eq 'meta') {
$self->{ META }
? $stack[0]->metadata(split(/\s+/, $para, 2))
@@ -359,12 +365,12 @@ sub parse_sequence {
elsif (defined $3) {
$rparen = $3;
$rparen =~ s/^\s+//;
- if ($rparen eq $stack[-1]->[RPAREN]) {
+ while ($rparen && $rparen =~ s/^$stack[-1]->[RPAREN]//) {
$cmd = $TEXTSEQ->new(pop(@stack))
|| return $self->error($TEXTSEQ->error());
push(@{ $stack[-1]->[CONTENT] }, $cmd);
}
- else {
+ if ($rparen) {
$self->warning((scalar @stack > 1
? "expected '$stack[-1]->[RPAREN]' not '$rparen'"
: "spurious '$rparen'"), $name, $line);
View
13 lib/Pod/POM/Constants.pm
@@ -7,15 +7,17 @@
#
# AUTHOR
# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
#
# COPYRIGHT
# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
#
# This module is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# REVISION
-# $Id: Constants.pm 32 2009-03-17 21:08:25Z ford $
+# $Id: Constants.pm 78 2009-08-20 20:44:53Z ford $
#
#========================================================================
@@ -24,8 +26,9 @@ package Pod::POM::Constants;
require 5.004;
use strict;
+
use vars qw( $VERSION @SEQUENCE @STATUS @EXPORT_OK %EXPORT_TAGS );
-use base qw( Exporter );
+use parent qw( Exporter );
$VERSION = sprintf("%d.%02d", q$Revision: 1.1.1.1 $ =~ /(\d+)\.(\d+)/);
@SEQUENCE = qw( CMD LPAREN RPAREN FILE LINE CONTENT );
@@ -63,12 +66,16 @@ Constants used by Pod::POM.
=head1 AUTHOR
-Andy Wardley E<LT>abw@kfs.orgE<gt>
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
View
11 lib/Pod/POM/Node.pm 100755 → 100644
@@ -15,7 +15,7 @@
# modify it under the same terms as Perl itself.
#
# REVISION
-# $Id: Node.pm 60 2009-03-20 12:41:35Z ford $
+# $Id: Node.pm 88 2010-04-02 13:37:41Z ford $
#
#========================================================================
@@ -79,7 +79,7 @@ sub new {
no strict qw( refs );
$attribs = \%{"$class\::ATTRIBS"} || [ ];
$accept = \@{"$class\::ACCEPT"} || [ ];
- unless (defined (%{"$class\::ACCEPT"})) {
+ unless (%{"$class\::ACCEPT"}) {
%{"$class\::ACCEPT"} = (
map { ( $_ => $NODES->{ $_ } ) } @$accept,
);
@@ -185,7 +185,12 @@ sub present {
my $type = $self->{ type };
my $method = "view_$type";
DEBUG("presenting method $method to $view\n");
- return $view->$method($self, @args);
+ my $txt = $view->$method($self, @args);
+ if ($view->can("encode")){
+ return $view->encode($txt);
+ } else {
+ return $txt;
+ }
}
View
65 lib/Pod/POM/Node/Begin.pm
@@ -0,0 +1,65 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Node::Begin
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: Begin.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::Begin;
+
+use strict;
+
+use parent qw( Pod::POM::Node );
+use vars qw( %ATTRIBS @ACCEPT $EXPECT $ERROR );
+
+%ATTRIBS = ( format => undef );
+@ACCEPT = qw( text verbatim code );
+$EXPECT = 'end';
+
+1;
+
+=head1 NAME
+
+Pod::POM::Node::Begin - POM '=begin' node class
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+This module implements a specialization of the node class to represent '=begin' elements.
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
69 lib/Pod/POM/Node/Code.pm
@@ -0,0 +1,69 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Node::Code
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: Code.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::Code;
+
+use strict;
+
+use parent qw( Pod::POM::Node );
+use vars qw( %ATTRIBS $ERROR );
+
+%ATTRIBS = ( text => '' );
+
+sub present {
+ my ($self, $view) = @_;
+ $view ||= $Pod::POM::DEFAULT_VIEW;
+ return $view->view_code($self->{ text });
+}
+
+1;
+
+=head1 NAME
+
+Pod::POM::Node::Code -
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+This module implements a specialization of the node class to represent code elements.
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
76 lib/Pod/POM/Node/Content.pm
@@ -0,0 +1,76 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Node::Content
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: Content.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::Content;
+
+use strict;
+
+use Pod::POM::Constants qw( :all );
+use parent qw( Pod::POM::Node );
+
+sub new {
+ my $class = shift;
+ return bless [ @_ ], $class;
+}
+
+sub present {
+ my ($self, $view) = @_;
+ $view ||= $Pod::POM::DEFAULT_VIEW;
+ return join('', map { ref $_ ? $_->present($view) : $_ } @$self);
+}
+
+
+1;
+
+
+=head1 NAME
+
+Pod::POM::Node::Content -
+
+=head1 SYNOPSIS
+
+ use Pod::POM::Nodes;
+
+=head1 DESCRIPTION
+
+This module implements a specialization of the node class to represent
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
72 lib/Pod/POM/Node/For.pm
@@ -0,0 +1,72 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Nodes
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: For.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::For;
+
+use strict;
+
+use parent qw( Pod::POM::Node );
+use vars qw( %ATTRIBS $ERROR );
+
+%ATTRIBS = ( format => undef, text => '' );
+
+sub new {
+ my $class = shift;
+ my $pom = shift;
+ my $text = shift;
+ return $class->SUPER::new($pom, split(/\s+/, $text, 2));
+}
+
+1;
+
+=head1 NAME
+
+Pod::POM::Node::For -
+
+=head1 SYNOPSIS
+
+ use Pod::POM::Nodes;
+
+=head1 DESCRIPTION
+
+This module implements a specialization of the node class to represent C<=for> elements.
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
74 lib/Pod/POM/Node/Head1.pm
@@ -0,0 +1,74 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Node::Head1
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: Head1.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::Head1;
+
+use strict;
+
+use parent qw( Pod::POM::Node );
+use vars qw( %ATTRIBS @ACCEPT $ERROR );
+
+%ATTRIBS = ( title => undef );
+@ACCEPT = qw( head2 head3 head4 over begin for text verbatim code );
+
+sub new {
+ my ($class, $pom, $title) = @_;
+ $title = $pom->parse_sequence($title)
+ || return $class->error($pom->error())
+ if length $title;
+ return $class->SUPER::new($pom, $title);
+}
+
+1;
+
+=head1 NAME
+
+Pod::POM::Node::Head1 -
+
+=head1 SYNOPSIS
+
+ use Pod::POM::Nodes;
+
+=head1 DESCRIPTION
+
+This module implements a specialization of the node class to represent C<=head1> elements.
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
74 lib/Pod/POM/Node/Head2.pm
@@ -0,0 +1,74 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Node::Head2
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: Head2.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::Head2;
+
+use strict;
+
+use parent qw( Pod::POM::Node );
+use vars qw( %ATTRIBS @ACCEPT $ERROR );
+
+%ATTRIBS = ( title => undef );
+@ACCEPT = qw( head3 head4 over begin for text verbatim code );
+
+sub new {
+ my ($class, $pom, $title) = @_;
+ $title = $pom->parse_sequence($title)
+ || return $class->error($pom->error())
+ if length $title;
+ return $class->SUPER::new($pom, $title);
+}
+
+1;
+
+=head1 NAME
+
+Pod::POM::Node::Head2 -
+
+=head1 SYNOPSIS
+
+ use Pod::POM::Nodes;
+
+=head1 DESCRIPTION
+
+This module implements a specialization of the node class to represent C<=head2> elements.
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
74 lib/Pod/POM/Node/Head3.pm
@@ -0,0 +1,74 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Node::Head3
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: Head3.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::Head3;
+
+use strict;
+
+use parent qw( Pod::POM::Node );
+use vars qw( %ATTRIBS @ACCEPT $ERROR );
+
+%ATTRIBS = ( title => undef );
+@ACCEPT = qw( head4 over begin for text verbatim code );
+
+sub new {
+ my ($class, $pom, $title) = @_;
+ $title = $pom->parse_sequence($title)
+ || return $class->error($pom->error())
+ if length $title;
+ return $class->SUPER::new($pom, $title);
+}
+
+1;
+
+=head1 NAME
+
+Pod::POM::Node::Head3 -
+
+=head1 SYNOPSIS
+
+ use Pod::POM::Nodes;
+
+=head1 DESCRIPTION
+
+This module implements a specialization of the node class to represent C<=head3> elements.
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
74 lib/Pod/POM/Node/Head4.pm
@@ -0,0 +1,74 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Node::Head4
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: Head4.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::Head4;
+
+use strict;
+
+use parent qw( Pod::POM::Node );
+use vars qw( %ATTRIBS @ACCEPT $ERROR );
+
+%ATTRIBS = ( title => undef );
+@ACCEPT = qw( over begin for text verbatim code );
+
+sub new {
+ my ($class, $pom, $title) = @_;
+ $title = $pom->parse_sequence($title)
+ || return $class->error($pom->error())
+ if length $title;
+ return $class->SUPER::new($pom, $title);
+}
+
+1;
+
+=head1 NAME
+
+Pod::POM::Node::Head4 -
+
+=head1 SYNOPSIS
+
+ use Pod::POM::Nodes;
+
+=head1 DESCRIPTION
+
+This module implements a specialization of the node class to represent C<=head4> elements.
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
74 lib/Pod/POM/Node/Item.pm
@@ -0,0 +1,74 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Nodes
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: Item.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::Item;
+
+use strict;
+
+use parent qw( Pod::POM::Node );
+use vars qw( %ATTRIBS @ACCEPT $ERROR );
+
+%ATTRIBS = ( title => '*' );
+@ACCEPT = qw( over begin for text verbatim code );
+
+sub new {
+ my ($class, $pom, $title) = @_;
+ $title = $pom->parse_sequence($title)
+ || return $class->error($pom->error())
+ if length $title;
+ return $class->SUPER::new($pom, $title);
+}
+
+1;
+
+=head1 NAME
+
+Pod::POM::Node::Item -
+
+=head1 SYNOPSIS
+
+ use Pod::POM::Nodes;
+
+=head1 DESCRIPTION
+
+This module implements a specialization of the node class to represent C<=item> elements.
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
95 lib/Pod/POM/Node/Over.pm
@@ -0,0 +1,95 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Node::Over
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: Over.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::Over;
+
+use strict;
+
+use parent qw( Pod::POM::Node );
+use vars qw( %ATTRIBS @ACCEPT $EXPECT $ERROR );
+
+%ATTRIBS = ( indent => 4 );
+@ACCEPT = qw( over item begin for text verbatim code );
+$EXPECT = 'back';
+
+sub list_type {
+ my $self = shift;
+ my ($first, @rest) = $self->content;
+
+ my $first_type = $first->type;
+ return;
+}
+
+
+1;
+
+=head1 NAME
+
+Pod::POM::Node::Over - POM '=over' node class
+
+=head1 SYNOPSIS
+
+ use Pod::POM::Nodes;
+
+=head1 DESCRIPTION
+
+This class implements '=over' Pod nodes. As described by the L<perlpodspec> man page =over/=back regions are
+used for various kinds of list-like structures (including blockquote paragraphs).
+
+ =item 1.
+
+ordered list
+
+ =item *
+
+ text paragraph
+
+unordered list
+
+ =item text
+
+ text paragraph
+
+definition list
+
+
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
65 lib/Pod/POM/Node/Pod.pm
@@ -0,0 +1,65 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Node::Pod
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: Pod.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::Pod;
+
+use strict;
+
+use parent qw( Pod::POM::Node );
+use vars qw( @ACCEPT $ERROR );
+
+@ACCEPT = qw( head1 head2 head3 head4 over begin for text verbatim code );
+
+1;
+
+=head1 NAME
+
+Pod::POM::Node::Pod -
+
+=head1 SYNOPSIS
+
+ use Pod::POM::Nodes;
+
+=head1 DESCRIPTION
+
+This module implements a specialization of the node class to represent C<=pod> elements.
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
109 lib/Pod/POM/Node/Sequence.pm
@@ -0,0 +1,109 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Node::Sequence
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: Sequence.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::Sequence;
+
+use strict;
+
+use Pod::POM::Constants qw( :all );
+use parent qw( Pod::POM::Node );
+use vars qw( %NAME );
+
+%NAME = (
+ C => 'code',
+ B => 'bold',
+ I => 'italic',
+ L => 'link',
+ S => 'space',
+ F => 'file',
+ X => 'index',
+ Z => 'zero',
+ E => 'entity',
+);
+
+sub new {
+ my ($class, $self) = @_;
+ local $" = '] [';
+ return bless \$self, $class;
+}
+
+sub add {
+ return IGNORE;
+}
+
+sub present {
+ my ($self, $view) = @_;
+ my ($cmd, $method, $result);
+ $view ||= $Pod::POM::DEFAULT_VIEW;
+
+ $self = $$self;
+ return $self unless ref $self eq 'ARRAY';
+
+ my $text = join('',
+ map { ref $_ ? $_->present($view)
+ : $view->view_seq_text($_) }
+ @{ $self->[CONTENT] });
+
+ if ($cmd = $self->[CMD]) {
+ my $method = $NAME{ $cmd } || $cmd;
+ $method = "view_seq_$method";
+ return $view->$method($text);
+ }
+ else {
+ return $text;
+ }
+}
+
+1;
+
+=head1 NAME
+
+Pod::POM::Node::Sequence -
+
+=head1 SYNOPSIS
+
+ use Pod::POM::Nodes;
+
+=head1 DESCRIPTION
+
+This module implements a specialization of the node class to represent sequence elements.
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
91 lib/Pod/POM/Node/Text.pm
@@ -0,0 +1,91 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Node::Text
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: Text.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::Text;
+
+use strict;
+
+use Pod::POM::Constants qw( :all );
+use parent qw( Pod::POM::Node );
+use vars qw( %ATTRIBS $ERROR );
+
+%ATTRIBS = ( text => '' );
+
+sub new {
+ my $class = shift;
+ my $pom = shift;
+ my $text = shift;
+ $text = $pom->parse_sequence($text)
+ || return $class->error($pom->error())
+ if length $text && ! $pom->{in_begin};
+ return $class->SUPER::new($pom, $text);
+}
+
+sub add {
+ return IGNORE;
+}
+
+sub present {
+ my ($self, $view) = @_;
+ my $text = $self->{ text };
+ $view ||= $Pod::POM::DEFAULT_VIEW;
+
+ $text = $text->present($view)
+ if ref $text;
+
+ return $view->view_textblock($text);
+}
+
+1;
+
+=head1 NAME
+
+Pod::POM::Node::Text -
+
+=head1 SYNOPSIS
+
+ use Pod::POM::Nodes;
+
+=head1 DESCRIPTION
+
+This module implements a specialization of the node class to represent text elements.
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
71 lib/Pod/POM/Node/Verbatim.pm
@@ -0,0 +1,71 @@
+#============================================================= -*-Perl-*-
+#
+# Pod::POM::Node::Verbatim
+#
+# DESCRIPTION
+# Module implementing specific nodes in a Pod::POM, subclassed from
+# Pod::POM::Node.
+#
+# AUTHOR
+# Andy Wardley <abw@kfs.org>
+# Andrew Ford <a.ford@ford-mason.co.uk>
+#
+# COPYRIGHT
+# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+# Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
+#
+# REVISION
+# $Id: Verbatim.pm 76 2009-08-20 20:41:33Z ford $
+#
+#========================================================================
+
+package Pod::POM::Node::Verbatim;
+
+use strict;
+
+use parent qw( Pod::POM::Node );
+use vars qw( %ATTRIBS $ERROR );
+
+%ATTRIBS = ( text => '' );
+
+sub present {
+ my ($self, $view) = @_;
+ $view ||= $Pod::POM::DEFAULT_VIEW;
+ return $view->view_verbatim($self->{ text });
+}
+
+1;
+
+=head1 NAME
+
+Pod::POM::Node::Verbatim -
+
+=head1 SYNOPSIS
+
+ use Pod::POM::Nodes;
+
+=head1 DESCRIPTION
+
+This module implements a specialization of the node class to represent verbatim elements.
+
+=head1 AUTHOR
+
+Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
+
+Andy Wardley E<lt>abw@kfs.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
+
+Copyright (C) 2009 Andrew Ford. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Consult L<Pod::POM::Node> for a discussion of nodes.
View
287 lib/Pod/POM/Nodes.pm
@@ -16,7 +16,7 @@
# modify it under the same terms as Perl itself.
#
# REVISION
-# $Id: Nodes.pm 14 2009-03-13 08:19:40Z ford $
+# $Id: Nodes.pm 76 2009-08-20 20:41:33Z ford $
#
#========================================================================
@@ -26,274 +26,57 @@ require 5.004;
require Exporter;
use strict;
-use Pod::POM::Node;
+
+use Pod::POM::Node::Pod;
+use Pod::POM::Node::Head1;
+use Pod::POM::Node::Head2;
+use Pod::POM::Node::Head3;
+use Pod::POM::Node::Head4;
+use Pod::POM::Node::Over;
+use Pod::POM::Node::Item;
+use Pod::POM::Node::Begin;
+use Pod::POM::Node::For;
+use Pod::POM::Node::Verbatim;
+use Pod::POM::Node::Code;
+use Pod::POM::Node::Text;
+use Pod::POM::Node::Sequence;
+use Pod::POM::Node::Content;
+
+
use vars qw( $VERSION $DEBUG $ERROR @EXPORT_OK @EXPORT_FAIL );
use base qw( Exporter );
$VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
$DEBUG = 0 unless defined $DEBUG;
+1;
-#------------------------------------------------------------------------
-package Pod::POM::Node::Pod;
-use base qw( Pod::POM::Node );
-use vars qw( @ACCEPT $ERROR );
-
-@ACCEPT = qw( head1 head2 head3 head4 over begin for text verbatim code );
-
-
-#------------------------------------------------------------------------
-package Pod::POM::Node::Head1;
-use base qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $ERROR );
-
-%ATTRIBS = ( title => undef );
-@ACCEPT = qw( head2 head3 head4 over begin for text verbatim code );
-
-sub new {
- my ($class, $pom, $title) = @_;
- $title = $pom->parse_sequence($title)
- || return $class->error($pom->error())
- if length $title;
- $class->SUPER::new($pom, $title);
-}
-
-
-#------------------------------------------------------------------------
-package Pod::POM::Node::Head2;
-use base qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $ERROR );
-
-%ATTRIBS = ( title => undef );
-@ACCEPT = qw( head3 head4 over begin for text verbatim code );
-
-sub new {
- my ($class, $pom, $title) = @_;
- $title = $pom->parse_sequence($title)
- || return $class->error($pom->error())
- if length $title;
- $class->SUPER::new($pom, $title);
-}
-
-
-#------------------------------------------------------------------------
-package Pod::POM::Node::Head3;
-use base qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $ERROR );
-
-%ATTRIBS = ( title => undef );
-@ACCEPT = qw( head4 over begin for text verbatim code );
-
-sub new {
- my ($class, $pom, $title) = @_;
- $title = $pom->parse_sequence($title)
- || return $class->error($pom->error())
- if length $title;
- $class->SUPER::new($pom, $title);
-}
-
-
-#------------------------------------------------------------------------
-package Pod::POM::Node::Head4;
-use base qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $ERROR );
-
-%ATTRIBS = ( title => undef );
-@ACCEPT = qw( over begin for text verbatim code );
-
-sub new {
- my ($class, $pom, $title) = @_;
- $title = $pom->parse_sequence($title)
- || return $class->error($pom->error())
- if length $title;
- $class->SUPER::new($pom, $title);
-}
-
-
-#------------------------------------------------------------------------
-package Pod::POM::Node::Over;
-use base qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $EXPECT $ERROR );
-
-%ATTRIBS = ( indent => 4 );
-@ACCEPT = qw( over item begin for text verbatim code );
-$EXPECT = 'back';
-
-
-#------------------------------------------------------------------------
-package Pod::POM::Node::Item;
-use base qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $ERROR );
-
-%ATTRIBS = ( title => '*' );
-@ACCEPT = qw( over begin for text verbatim code );
-
-sub new {
- my ($class, $pom, $title) = @_;
- $title = $pom->parse_sequence($title)
- || return $class->error($pom->error())
- if length $title;
- $class->SUPER::new($pom, $title);
-}
-
-
-#------------------------------------------------------------------------
-package Pod::POM::Node::Begin;
-use base qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $EXPECT $ERROR );
-
-%ATTRIBS = ( format => undef );
-@ACCEPT = qw( text verbatim code );
-$EXPECT = 'end';
-
-
-#------------------------------------------------------------------------
-package Pod::POM::Node::For;
-use base qw( Pod::POM::Node );
-use vars qw( %ATTRIBS $ERROR );
-
-%ATTRIBS = ( format => undef, text => '' );
-
-sub new {
- my $class = shift;
- my $pom = shift;
- my $text = shift;
- $class->SUPER::new($pom, split(/\s+/, $text, 2));
-}
-
-
-#------------------------------------------------------------------------
-package Pod::POM::Node::Verbatim;
-use base qw( Pod::POM::Node );
-use vars qw( %ATTRIBS $ERROR );
-
-%ATTRIBS = ( text => '' );
-
-sub present {
- my ($self, $view) = @_;
- $view ||= $Pod::POM::DEFAULT_VIEW;
- $view->view_verbatim($self->{ text });
-}
-
-
-#------------------------------------------------------------------------
-package Pod::POM::Node::Code;
-use base qw( Pod::POM::Node );
-use vars qw( %ATTRIBS $ERROR );
-
-%ATTRIBS = ( text => '' );
-
-sub present {
- my ($self, $view) = @_;
- $view ||= $Pod::POM::DEFAULT_VIEW;
- $view->view_code($self->{ text });
-}
-
-
-#------------------------------------------------------------------------
-package Pod::POM::Node::Text;
-use Pod::POM::Constants qw( :all );
-use base qw( Pod::POM::Node );
-use vars qw( %ATTRIBS $ERROR );
-
-%ATTRIBS = ( text => '' );
-
-sub new {
- my $class = shift;
- my $pom = shift;
- my $text = shift;
- $text = $pom->parse_sequence($text)
- || return $class->error($pom->error())
- if length $text && ! $pom->{in_begin};
- $class->SUPER::new($pom, $text);
-}
-
-sub add {
- return IGNORE;
-}
-
-sub present {
- my ($self, $view) = @_;
- my $text = $self->{ text };
- $view ||= $Pod::POM::DEFAULT_VIEW;
-
- $text = $text->present($view)
- if ref $text;
-
- $view->view_textblock($text);
-}
-
-
-#------------------------------------------------------------------------
-package Pod::POM::Node::Sequence;
-
-use Pod::POM::Constants qw( :all );
-use base qw( Pod::POM::Node );
-use vars qw( %NAME );
+=head1 NAME
-%NAME = (
- C => 'code',
- B => 'bold',
- I => 'italic',
- L => 'link',
- S => 'space',
- F => 'file',
- X => 'index',
- Z => 'zero',
- E => 'entity',
-);
-
-sub new {
- my ($class, $self) = @_;
- local $" = '] [';
- bless \$self, $class;
-}
+Pod::POM::Nodes - convenience class to load all node classes
-sub add {
- return IGNORE;
-}
+=head1 SYNOPSIS
-sub present {
- my ($self, $view) = @_;
- my ($cmd, $method, $result);
- $view ||= $Pod::POM::DEFAULT_VIEW;
+ use Pod::POM::Nodes;
- $self = $$self;
- return $self unless ref $self eq 'ARRAY';
+=head1 DESCRIPTION
- my $text = join('',
- map { ref $_ ? $_->present($view)
- : $view->view_seq_text($_) }
- @{ $self->[CONTENT] });
-
- if ($cmd = $self->[CMD]) {
- my $method = $NAME{ $cmd } || $cmd;
- $method = "view_seq_$method";
- return $view->$method($text);
- }
- else {
- return $text;
- }
-}
+This module implements a convenience class that simply uses all of the subclasses of Pod::POM::Node.
+(It used to include all the individual classes inline, but the node classes have been factored out
+into individual modules.)
+=head1 AUTHOR
-#------------------------------------------------------------------------
-package Pod::POM::Node::Content;
+Andy Wardley E<lt>abw@kfs.orgE<gt>
-use Pod::POM::Constants qw( :all );
-use base qw( Pod::POM::Node );
+=head1 COPYRIGHT
-sub new {
- my $class = shift;
- bless [ @_ ], $class;
-}
+Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
-sub present {
- my ($self, $view) = @_;
- $view ||= $Pod::POM::DEFAULT_VIEW;
- return join('', map { ref $_ ? $_->present($view) : $_ } @$self);
-}
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+=head1 SEE ALSO
-1;
+Consult L<Pod::POM> for a general overview and examples of use.
View
22 lib/Pod/POM/View/HTML.pm
@@ -15,7 +15,7 @@
# modify it under the same terms as Perl itself.
#
# REVISION
-# $Id: HTML.pm 33 2009-03-17 21:10:42Z ford $
+# $Id: HTML.pm 84 2009-08-20 21:07:00Z ford $
#
#========================================================================
@@ -25,9 +25,8 @@ require 5.004;
use strict;
use Pod::POM::View;
-use base qw( Pod::POM::View );
+use parent qw( Pod::POM::View );
use vars qw( $VERSION $DEBUG $ERROR $AUTOLOAD );
-use HTML::Entities;
use Text::Wrap;
$VERSION = sprintf("%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/);
@@ -209,7 +208,11 @@ sub view_textblock {
sub view_verbatim {
my ($self, $text) = @_;
- $text = encode_entities($text);
+ for ($text) {
+ s/&/&amp;/g;
+ s/</&lt;/g;
+ s/>/&gt;/g;
+ }
return "<pre>$text</pre>\n\n";
}
@@ -367,7 +370,11 @@ sub view_seq_text {
my ($self, $text) = @_;
unless ($HTML_PROTECT) {
- $text = encode_entities($text);
+ for ($text) {
+ s/&/&amp;/g;
+ s/</&lt;/g;
+ s/>/&gt;/g;
+ }
}
$text =~ s{
@@ -394,6 +401,11 @@ sub view_seq_text {
return $text;
}
+sub encode {
+ my($self,$text) = @_;
+ require Encode;
+ return Encode::encode("ascii",$text,Encode::FB_XMLCREF());
+}
1;
View
4 lib/Pod/POM/View/Pod.pm
@@ -15,7 +15,7 @@
# modify it under the same terms as Perl itself.
#
# REVISION
-# $Id: Pod.pm 61 2009-03-20 12:42:40Z ford $
+# $Id: Pod.pm 77 2009-08-20 20:44:14Z ford $
#
#========================================================================
@@ -26,7 +26,7 @@ require 5.004;
use strict;
use Pod::POM::Nodes;
use Pod::POM::View;
-use base qw( Pod::POM::View );
+use parent qw( Pod::POM::View );
use vars qw( $VERSION $DEBUG $ERROR $AUTOLOAD $MARKUP );
$VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
View
4 lib/Pod/POM/View/Text.pm
@@ -15,7 +15,7 @@
# modify it under the same terms as Perl itself.
#
# REVISION
-# $Id: Text.pm 34 2009-03-17 21:11:05Z ford $
+# $Id: Text.pm 77 2009-08-20 20:44:14Z ford $
#
#========================================================================
@@ -25,7 +25,7 @@ require 5.004;
use strict;
use Pod::POM::View;
-use base qw( Pod::POM::View );
+use parent qw( Pod::POM::View );
use vars qw( $VERSION $DEBUG $ERROR $AUTOLOAD $INDENT );
use Text::Wrap;

0 comments on commit 0a819d6

Please sign in to comment.