1 |
|
---|
2 | require 5;
|
---|
3 | package Pod::Perldoc::ToText;
|
---|
4 | use strict;
|
---|
5 | use warnings;
|
---|
6 |
|
---|
7 | use base qw(Pod::Perldoc::BaseTo);
|
---|
8 |
|
---|
9 | sub is_pageable { 1 }
|
---|
10 | sub write_with_binmode { 0 }
|
---|
11 | sub output_extension { 'txt' }
|
---|
12 |
|
---|
13 | use Pod::Text ();
|
---|
14 |
|
---|
15 | sub alt { shift->_perldoc_elem('alt' , @_) }
|
---|
16 | sub indent { shift->_perldoc_elem('indent' , @_) }
|
---|
17 | sub loose { shift->_perldoc_elem('loose' , @_) }
|
---|
18 | sub quotes { shift->_perldoc_elem('quotes' , @_) }
|
---|
19 | sub sentence { shift->_perldoc_elem('sentence', @_) }
|
---|
20 | sub width { shift->_perldoc_elem('width' , @_) }
|
---|
21 |
|
---|
22 | sub new { return bless {}, ref($_[0]) || $_[0] }
|
---|
23 |
|
---|
24 | sub parse_from_file {
|
---|
25 | my $self = shift;
|
---|
26 |
|
---|
27 | my @options =
|
---|
28 | map {; $_, $self->{$_} }
|
---|
29 | grep !m/^_/s,
|
---|
30 | keys %$self
|
---|
31 | ;
|
---|
32 |
|
---|
33 | defined(&Pod::Perldoc::DEBUG)
|
---|
34 | and Pod::Perldoc::DEBUG()
|
---|
35 | and print "About to call new Pod::Text ",
|
---|
36 | $Pod::Text::VERSION ? "(v$Pod::Text::VERSION) " : '',
|
---|
37 | "with options: ",
|
---|
38 | @options ? "[@options]" : "(nil)", "\n";
|
---|
39 | ;
|
---|
40 |
|
---|
41 | Pod::Text->new(@options)->parse_from_file(@_);
|
---|
42 | }
|
---|
43 |
|
---|
44 | 1;
|
---|
45 |
|
---|
46 | =head1 NAME
|
---|
47 |
|
---|
48 | Pod::Perldoc::ToText - let Perldoc render Pod as plaintext
|
---|
49 |
|
---|
50 | =head1 SYNOPSIS
|
---|
51 |
|
---|
52 | perldoc -o text Some::Modulename
|
---|
53 |
|
---|
54 | =head1 DESCRIPTION
|
---|
55 |
|
---|
56 | This is a "plug-in" class that allows Perldoc to use
|
---|
57 | Pod::Text as a formatter class.
|
---|
58 |
|
---|
59 | It supports the following options, which are explained in
|
---|
60 | L<Pod::Text>: alt, indent, loose, quotes, sentence, width
|
---|
61 |
|
---|
62 | For example:
|
---|
63 |
|
---|
64 | perldoc -o text -w indent:5 Some::Modulename
|
---|
65 |
|
---|
66 | =head1 CAVEAT
|
---|
67 |
|
---|
68 | This module may change to use a different text formatter class in the
|
---|
69 | future, and this may change what options are supported.
|
---|
70 |
|
---|
71 | =head1 SEE ALSO
|
---|
72 |
|
---|
73 | L<Pod::Text>, L<Pod::Perldoc>
|
---|
74 |
|
---|
75 | =head1 COPYRIGHT AND DISCLAIMERS
|
---|
76 |
|
---|
77 | Copyright (c) 2002 Sean M. Burke. All rights reserved.
|
---|
78 |
|
---|
79 | This library is free software; you can redistribute it and/or modify it
|
---|
80 | under the same terms as Perl itself.
|
---|
81 |
|
---|
82 | This program is distributed in the hope that it will be useful, but
|
---|
83 | without any warranty; without even the implied warranty of
|
---|
84 | merchantability or fitness for a particular purpose.
|
---|
85 |
|
---|
86 | =head1 AUTHOR
|
---|
87 |
|
---|
88 | Sean M. Burke C<[email protected]>
|
---|
89 |
|
---|
90 | =cut
|
---|
91 |
|
---|