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