File: ToMarkdown.pm

package info (click to toggle)
libpod-markdown-perl 3.400000-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 456 kB
  • sloc: perl: 1,010; makefile: 2
file content (113 lines) | stat: -rw-r--r-- 2,241 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#
# This file is part of Pod-Markdown
#
# This software is copyright (c) 2011 by Randy Stauner.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
use strict;
use warnings;

package Pod::Perldoc::ToMarkdown;
our $AUTHORITY = 'cpan:RWSTAUNER';
$Pod::Perldoc::ToMarkdown::VERSION = '3.400';
# ABSTRACT: Enable `perldoc -o Markdown`

use parent qw(Pod::Markdown);

sub new {
  my $class = shift;
  my $self = $class->SUPER::new(
    # Pod::Perldoc does not pass any options by default
    # but will call setters if attributes are passed on command line.
    # I don't know what encoding it expects, but it needs one, so default to UTF-8.
    output_encoding => 'UTF-8',
    @_,
  );
  return $self;
}

sub parse_from_file {
  my $self = shift;
  # Instantiate if called as a class method.
  $self = $self->new if !ref $self;

  # Skip over SUPER's override and go up to grandpa's method.
  $self->Pod::Simple::parse_from_file(@_);
}

# There are several other methods that we could implement that Pod::Perldoc
# finds interesting:
# * output_is_binary
# * name
# * output_extension

1;

__END__

=pod

=encoding UTF-8

=for :stopwords Marcel Gruenauer Victor Moral Ryan C. Thompson <rct at thompsonclan d0t
org> Aristotle Pagaltzis Randy Stauner ACKNOWLEDGEMENTS

=head1 NAME

Pod::Perldoc::ToMarkdown - Enable `perldoc -o Markdown`

=head1 VERSION

version 3.400

=for test_synopsis 1;
__END__

=head1 SYNOPSIS

  perldoc -o Markdown Some::Module

=head1 DESCRIPTION

Pod::Perldoc expects a Pod::Parser compatible module,
however Pod::Markdown did not historically provide an entirely Pod::Parser
compatible interface.

This module bridges the gap.

=head1 AUTHORS

=over 4

=item *

Marcel Gruenauer <marcel@cpan.org>

=item *

Victor Moral <victor@taquiones.net>

=item *

Ryan C. Thompson <rct at thompsonclan d0t org>

=item *

Aristotle Pagaltzis <pagaltzis@gmx.de>

=item *

Randy Stauner <rwstauner@cpan.org>

=back

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Randy Stauner.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut