This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Pod::Plainer to 1.01 like Maintainers.pl says it is
[perl5.git] / dist / Pod-Plainer / Plainer.pm
1 package Pod::Plainer;
2 use 5.006;
3 use strict;
4 use warnings;
5 use if $] >= 5.011, 'deprecate';
6 use Pod::Parser;
7 our @ISA = qw(Pod::Parser);
8 our $VERSION = '1.01';
9
10 our %E = qw( < lt > gt );
11  
12 sub escape_ltgt {
13     (undef, my $text) = @_;
14     $text =~ s/([<>])/E<$E{$1}>/g;
15     $text 
16
17
18 sub simple_delimiters {
19     (undef, my $seq) = @_;
20     $seq -> left_delimiter( '<' ); 
21     $seq -> right_delimiter( '>' );  
22     $seq;
23 }
24
25 sub textblock {
26     my($parser,$text,$line) = @_;
27     print {$parser->output_handle()}
28         $parser->parse_text(
29             { -expand_text => q(escape_ltgt),
30               -expand_seq => q(simple_delimiters) },
31             $text, $line ) -> raw_text(); 
32 }
33
34 1;
35
36 __END__
37
38 =head1 NAME
39
40 Pod::Plainer - Perl extension for converting Pod to old-style Pod.
41
42 =head1 SYNOPSIS
43
44   use Pod::Plainer;
45
46   my $parser = Pod::Plainer -> new ();
47   $parser -> parse_from_filehandle(\*STDIN);
48
49 =head1 DESCRIPTION
50
51 Pod::Plainer uses Pod::Parser which takes Pod with the (new)
52 'CE<lt>E<lt> .. E<gt>E<gt>' constructs
53 and returns the old(er) style with just 'CE<lt>E<gt>';
54 '<' and '>' are replaced by 'EE<lt>ltE<gt>' and 'EE<lt>gtE<gt>'.
55
56 This can be used to pre-process Pod before using tools which do not
57 recognise the new style Pods.
58
59 =head2 METHODS
60
61 =over
62
63 =item escape_ltgt
64
65 Replace '<' and '>' by 'EE<lt>ltE<gt>' and 'EE<lt>gtE<gt>'.
66
67 =item simple_delimiters
68
69 Replace delimiters by 'E<lt>' and 'E<gt>'.
70
71 =item textblock
72
73 Redefine C<textblock> from L<Pod::Parser> to use C<escape_ltgt>
74 and C<simple_delimiters>.
75
76 =back
77
78 =head2 EXPORT
79
80 None by default.
81
82 =head1 AUTHOR
83
84 Robin Barker, rmb1@npl.co.uk
85
86 =head1 SEE ALSO
87
88 See L<Pod::Parser>.
89
90 =head1 COPYRIGHT AND LICENSE
91
92 Copyright (C) 2009 by Robin Barker
93
94 This library is free software; you can redistribute it and/or modify
95 it under the same terms as Perl itself, either Perl version 5.10.1 or,
96 at your option, any later version of Perl 5 you may have available.
97
98 =cut
99
100 $Id: Plainer.pm 250 2009-09-20 18:02:00Z rmb1 $