Make given() statements return the last evaluated expression
[p5sagit/p5-mst-13.2.git] / dist / Pod-Plainer / Plainer.pm
CommitLineData
d23ed1f2 1package Pod::Plainer;
63377b8d 2use 5.006;
d23ed1f2 3use strict;
63377b8d 4use warnings;
6fcc101e 5use if $] >= 5.011, 'deprecate';
d23ed1f2 6use Pod::Parser;
7our @ISA = qw(Pod::Parser);
63377b8d 8our $VERSION = '1.01';
d23ed1f2 9
10our %E = qw( < lt > gt );
11
12sub escape_ltgt {
13 (undef, my $text) = @_;
14 $text =~ s/([<>])/E<$E{$1}>/g;
15 $text
16}
17
18sub simple_delimiters {
19 (undef, my $seq) = @_;
20 $seq -> left_delimiter( '<' );
21 $seq -> right_delimiter( '>' );
22 $seq;
23}
24
25sub 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
341;
35
36__END__
37
38=head1 NAME
39
1f766de9 40Pod::Plainer - Perl extension for converting Pod to old-style Pod.
d23ed1f2 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
51Pod::Plainer uses Pod::Parser which takes Pod with the (new)
52'CE<lt>E<lt> .. E<gt>E<gt>' constructs
53and 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
56This can be used to pre-process Pod before using tools which do not
57recognise the new style Pods.
58
63377b8d 59=head2 METHODS
60
61=over
62
63=item escape_ltgt
64
65Replace '<' and '>' by 'EE<lt>ltE<gt>' and 'EE<lt>gtE<gt>'.
66
67=item simple_delimiters
68
69Replace delimiters by 'E<lt>' and 'E<gt>'.
70
71=item textblock
72
73Redefine C<textblock> from L<Pod::Parser> to use C<escape_ltgt>
74and C<simple_delimiters>.
75
76=back
77
d23ed1f2 78=head2 EXPORT
79
80None by default.
81
82=head1 AUTHOR
83
1f766de9 84Robin Barker, rmb1@npl.co.uk
d23ed1f2 85
86=head1 SEE ALSO
87
88See L<Pod::Parser>.
89
63377b8d 90=head1 COPYRIGHT AND LICENSE
91
92Copyright (C) 2009 by Robin Barker
93
94This library is free software; you can redistribute it and/or modify
95it under the same terms as Perl itself, either Perl version 5.10.1 or,
96at your option, any later version of Perl 5 you may have available.
97
d23ed1f2 98=cut
99
63377b8d 100$Id: Plainer.pm 250 2009-09-20 18:02:00Z rmb1 $