summaryrefslogtreecommitdiff
path: root/lib/Pod
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-03-08 12:41:38 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-03-08 12:41:38 +0000
commitd23ed1f2ad4fab0ab337e1558f4157d663b72860 (patch)
tree1514a818f3f4c76e090d395ee8df40f51758b681 /lib/Pod
parentf07cf794e2ddad870bcc5abe24ba4bd3bcabf9e2 (diff)
downloadperl-d23ed1f2ad4fab0ab337e1558f4157d663b72860.tar.gz
shore up pod2latex shortcomings, and a Pod::Parser fix (from
Robin Barker) p4raw-id: //depot/perl@5612
Diffstat (limited to 'lib/Pod')
-rw-r--r--lib/Pod/Parser.pm3
-rw-r--r--lib/Pod/Plainer.pm69
2 files changed, 70 insertions, 2 deletions
diff --git a/lib/Pod/Parser.pm b/lib/Pod/Parser.pm
index 9ad5d161ed..88d9aa7a8f 100644
--- a/lib/Pod/Parser.pm
+++ b/lib/Pod/Parser.pm
@@ -956,8 +956,7 @@ sub parse_paragraph {
## and whatever sequence of characters was used to separate them
$pfx = $1;
$_ = substr($text, length $pfx);
- $sep = /(\s+)(?=\S)/ ? $1 : '';
- ($cmd, $text) = split(" ", $_, 2);
+ ($cmd, $sep, $text) = split /(\s+)/, $_, 2;
## If this is a "cut" directive then we dont need to do anything
## except return to "cutting" mode.
if ($cmd eq 'cut') {
diff --git a/lib/Pod/Plainer.pm b/lib/Pod/Plainer.pm
new file mode 100644
index 0000000000..373e8d090a
--- /dev/null
+++ b/lib/Pod/Plainer.pm
@@ -0,0 +1,69 @@
+package Pod::Plainer;
+use strict;
+use Pod::Parser;
+our @ISA = qw(Pod::Parser);
+our $VERSION = '0.01';
+
+our %E = qw( < lt > gt );
+
+sub escape_ltgt {
+ (undef, my $text) = @_;
+ $text =~ s/([<>])/E<$E{$1}>/g;
+ $text
+}
+
+sub simple_delimiters {
+ (undef, my $seq) = @_;
+ $seq -> left_delimiter( '<' );
+ $seq -> right_delimiter( '>' );
+ $seq;
+}
+
+sub textblock {
+ my($parser,$text,$line) = @_;
+ print {$parser->output_handle()}
+ $parser->parse_text(
+ { -expand_text => q(escape_ltgt),
+ -expand_seq => q(simple_delimiters) },
+ $text, $line ) -> raw_text();
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Pod::Plainer - Perl extension for converting Pod to old style Pod.
+
+=head1 SYNOPSIS
+
+ use Pod::Plainer;
+
+ my $parser = Pod::Plainer -> new ();
+ $parser -> parse_from_filehandle(\*STDIN);
+
+=head1 DESCRIPTION
+
+Pod::Plainer uses Pod::Parser which takes Pod with the (new)
+'CE<lt>E<lt> .. E<gt>E<gt>' constructs
+and returns the old(er) style with just 'CE<lt>E<gt>';
+'<' and '>' are replaced by 'EE<lt>ltE<gt>' and 'EE<lt>gtE<gt>'.
+
+This can be used to pre-process Pod before using tools which do not
+recognise the new style Pods.
+
+=head2 EXPORT
+
+None by default.
+
+=head1 AUTHOR
+
+Robin Barker, rmb1@cise.npl.co.uk
+
+=head1 SEE ALSO
+
+See L<Pod::Parser>.
+
+=cut
+