xref: /openbsd-src/gnu/usr.bin/perl/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToANSI.pm (revision 9f11ffb7133c203312a01e4b986886bc88c7d74b)
1898184e3Ssthenpackage Pod::Perldoc::ToANSI;
2898184e3Ssthenuse strict;
3898184e3Ssthenuse warnings;
4898184e3Ssthenuse parent qw(Pod::Perldoc::BaseTo);
5898184e3Ssthen
6898184e3Ssthenuse vars qw($VERSION);
7*9f11ffb7Safresh1$VERSION = '3.28';
8898184e3Ssthen
9898184e3Ssthensub is_pageable        { 1 }
10898184e3Ssthensub write_with_binmode { 0 }
11898184e3Ssthensub output_extension   { 'txt' }
12898184e3Ssthen
13898184e3Ssthenuse Pod::Text::Color ();
14898184e3Ssthen
15898184e3Ssthensub alt       { shift->_perldoc_elem('alt'     , @_) }
16898184e3Ssthensub indent    { shift->_perldoc_elem('indent'  , @_) }
17898184e3Ssthensub loose     { shift->_perldoc_elem('loose'   , @_) }
18898184e3Ssthensub quotes    { shift->_perldoc_elem('quotes'  , @_) }
19898184e3Ssthensub sentence  { shift->_perldoc_elem('sentence', @_) }
20898184e3Ssthensub width     { shift->_perldoc_elem('width'   , @_) }
21898184e3Ssthen
22898184e3Ssthensub new { return bless {}, ref($_[0]) || $_[0] }
23898184e3Ssthen
24898184e3Ssthensub parse_from_file {
25898184e3Ssthen  my $self = shift;
26898184e3Ssthen
27898184e3Ssthen  my @options =
28898184e3Ssthen    map {; $_, $self->{$_} }
29898184e3Ssthen      grep !m/^_/s,
30898184e3Ssthen        keys %$self
31898184e3Ssthen  ;
32898184e3Ssthen
33898184e3Ssthen  defined(&Pod::Perldoc::DEBUG)
34898184e3Ssthen   and Pod::Perldoc::DEBUG()
35898184e3Ssthen   and print "About to call new Pod::Text::Color ",
36898184e3Ssthen    $Pod::Text::VERSION ? "(v$Pod::Text::VERSION) " : '',
37898184e3Ssthen    "with options: ",
38898184e3Ssthen    @options ? "[@options]" : "(nil)", "\n";
39898184e3Ssthen  ;
40898184e3Ssthen
41898184e3Ssthen  Pod::Text::Color->new(@options)->parse_from_file(@_);
42898184e3Ssthen}
43898184e3Ssthen
44898184e3Ssthen1;
45898184e3Ssthen
46898184e3Ssthen=head1 NAME
47898184e3Ssthen
48898184e3SsthenPod::Perldoc::ToANSI - render Pod with ANSI color escapes
49898184e3Ssthen
50898184e3Ssthen=head1 SYNOPSIS
51898184e3Ssthen
52898184e3Ssthen  perldoc -o ansi Some::Modulename
53898184e3Ssthen
54898184e3Ssthen=head1 DESCRIPTION
55898184e3Ssthen
56898184e3SsthenThis is a "plug-in" class that allows Perldoc to use
57898184e3SsthenPod::Text as a formatter class.
58898184e3Ssthen
59898184e3SsthenIt supports the following options, which are explained in
60898184e3SsthenL<Pod::Text>: alt, indent, loose, quotes, sentence, width
61898184e3Ssthen
62898184e3SsthenFor example:
63898184e3Ssthen
64898184e3Ssthen  perldoc -o term -w indent:5 Some::Modulename
65898184e3Ssthen
66898184e3Ssthen=head1 CAVEAT
67898184e3Ssthen
68898184e3SsthenThis module may change to use a different text formatter class in the
69898184e3Ssthenfuture, and this may change what options are supported.
70898184e3Ssthen
71898184e3Ssthen=head1 SEE ALSO
72898184e3Ssthen
73898184e3SsthenL<Pod::Text>, L<Pod::Text::Color>, L<Pod::Perldoc>
74898184e3Ssthen
75898184e3Ssthen=head1 COPYRIGHT AND DISCLAIMERS
76898184e3Ssthen
77898184e3SsthenCopyright (c) 2011 Mark Allen.  All rights reserved.
78898184e3Ssthen
79898184e3SsthenThis library is free software; you can redistribute it and/or modify it
80898184e3Ssthenunder the same terms as Perl itself.
81898184e3Ssthen
82898184e3SsthenThis program is distributed in the hope that it will be useful, but
83898184e3Ssthenwithout any warranty; without even the implied warranty of
84898184e3Ssthenmerchantability or fitness for a particular purpose.
85898184e3Ssthen
86898184e3Ssthen=head1 AUTHOR
87898184e3Ssthen
88898184e3SsthenCurrent maintainer: Mark Allen C<< <mallen@cpan.org> >>
89898184e3Ssthen
90898184e3SsthenPast contributions from:
91898184e3Ssthenbrian d foy C<< <bdfoy@cpan.org> >>
92898184e3SsthenAdriano R. Ferreira C<< <ferreira@cpan.org> >>,
93898184e3SsthenSean M. Burke C<< <sburke@cpan.org> >>
94898184e3Ssthen
95898184e3Ssthen
96898184e3Ssthen=cut
97