This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Move Pod::Plainer from ext/ to dist/
[perl5.git] / dist / Pod-Plainer / Plainer.pm
1 package Pod::Plainer;
2 use strict;
3 use if $] >= 5.011, 'deprecate';
4 use Pod::Parser;
5 our @ISA = qw(Pod::Parser);
6 our $VERSION = '1.00';
7
8 our %E = qw( < lt > gt );
9  
10 sub escape_ltgt {
11     (undef, my $text) = @_;
12     $text =~ s/([<>])/E<$E{$1}>/g;
13     $text 
14
15
16 sub simple_delimiters {
17     (undef, my $seq) = @_;
18     $seq -> left_delimiter( '<' ); 
19     $seq -> right_delimiter( '>' );  
20     $seq;
21 }
22
23 sub textblock {
24     my($parser,$text,$line) = @_;
25     print {$parser->output_handle()}
26         $parser->parse_text(
27             { -expand_text => q(escape_ltgt),
28               -expand_seq => q(simple_delimiters) },
29             $text, $line ) -> raw_text(); 
30 }
31
32 1;
33
34 __END__
35
36 =head1 NAME
37
38 Pod::Plainer - Perl extension for converting Pod to old-style Pod.
39
40 =head1 SYNOPSIS
41
42   use Pod::Plainer;
43
44   my $parser = Pod::Plainer -> new ();
45   $parser -> parse_from_filehandle(\*STDIN);
46
47 =head1 DESCRIPTION
48
49 Pod::Plainer uses Pod::Parser which takes Pod with the (new)
50 'CE<lt>E<lt> .. E<gt>E<gt>' constructs
51 and returns the old(er) style with just 'CE<lt>E<gt>';
52 '<' and '>' are replaced by 'EE<lt>ltE<gt>' and 'EE<lt>gtE<gt>'.
53
54 This can be used to pre-process Pod before using tools which do not
55 recognise the new style Pods.
56
57 =head2 EXPORT
58
59 None by default.
60
61 =head1 AUTHOR
62
63 Robin Barker, rmb1@npl.co.uk
64
65 =head1 SEE ALSO
66
67 See L<Pod::Parser>.
68
69 =cut
70