", '/Verbatim' => "\n", 'VerbatimFormatted' => "\n
", '/VerbatimFormatted' => "\n", 'VerbatimB' => "", '/VerbatimB' => "", 'VerbatimI' => "", '/VerbatimI' => "", 'VerbatimBI' => "", '/VerbatimBI' => "", 'Data' => "\n", '/Data' => "\n", 'head1' => "\n
..., I think ), '/item-bullet' => "$LamePad\n", '/item-number' => "$LamePad\n", '/item-text' => "$LamePad\n", 'item-body' => "\n
", '/C' => "",
'L' => "", # ideally never used!
'/L' => "",
);
sub changes {
return map {; m/^([-_:0-9a-zA-Z]+)=([-_:0-9a-zA-Z]+)$/s
? ( $1, => "\n<$2>", "/$1", => "$2>\n" ) : die "Funky $_"
} @_;
}
sub changes2 {
return map {; m/^([-_:0-9a-zA-Z]+)=([-_:0-9a-zA-Z]+)$/s
? ( $1, => "<$2>", "/$1", => "$2>" ) : die "Funky $_"
} @_;
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub go { Pod::Simple::HTML->parse_from_file(@ARGV); exit 0 }
# Just so we can run from the command line. No options.
# For that, use perldoc!
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub new {
my $new = shift->SUPER::new(@_);
#$new->nix_X_codes(1);
$new->nbsp_for_S(1);
$new->accept_targets( 'html', 'HTML' );
$new->accept_codes('VerbatimFormatted');
$new->accept_codes(@_to_accept);
DEBUG > 2 and print "To accept: ", join(' ',@_to_accept), "\n";
$new->perldoc_url_prefix( $Perldoc_URL_Prefix );
$new->perldoc_url_postfix( $Perldoc_URL_Postfix );
$new->man_url_prefix( $Man_URL_Prefix );
$new->man_url_postfix( $Man_URL_Postfix );
$new->title_prefix( $Title_Prefix );
$new->title_postfix( $Title_Postfix );
$new->html_header_before_title(
qq[$Doctype_decl, Verbatim text maps to (Computerese defaults to "")
$Pod::Simple::HTML::Computerese = ' class="some_class_name';
=head2 html_css
=head2 html_javascript
=head2 title_prefix
=head2 title_postfix
=head2 html_header_before_title
This includes everything before the opening tag including the Document type
and including the opening tag. The following call will set it to be a simple HTML
file:
$p->html_header_before_title('');
=head2 html_h_level
Normally =head1 will become , =head2 will become etc.
Using the html_h_level method will change these levels setting the h level
of =head1 tags:
$p->html_h_level(3);
Will make sure that =head1 will become and =head2 will become etc...
=head2 index
Set it to some true value if you want to have an index (in reality a table of contents)
to be added at the top of the generated HTML.
$p->index(1);
=head2 html_header_after_title
Includes the closing tag of
and through the rest of the head
till the opening of the body
$p->html_header_after_title(' ... ');
=head2 html_footer
The very end of the document:
$p->html_footer( qq[\n\n\n\n] );
=head1 SUBCLASSING
Can use any of the methods described above but for further customization
one needs to override some of the methods:
package My::Pod;
use strict;
use warnings;
use base 'Pod::Simple::HTML';
# needs to return a URL string such
# http://some.other.com/page.html
# #anchor_in_the_same_file
# /internal/ref.html
sub do_pod_link {
# My::Pod object and Pod::Simple::PullParserStartToken object
my ($self, $link) = @_;
say $link->tagname; # will be L for links
say $link->attr('to'); #
say $link->attr('type'); # will be 'pod' always
say $link->attr('section');
# Links local to our web site
if ($link->tagname eq 'L' and $link->attr('type') eq 'pod') {
my $to = $link->attr('to');
if ($to =~ /^Padre::/) {
$to =~ s{::}{/}g;
return "/docs/Padre/$to.html";
}
}
# all other links are generated by the parent class
my $ret = $self->SUPER::do_pod_link($link);
return $ret;
}
1;
Meanwhile in script.pl:
use My::Pod;
my $p = My::Pod->new;
my $html;
$p->output_string(\$html);
$p->parse_file('path/to/Module/Name.pm');
open my $out, '>', 'out.html' or die;
print $out $html;
TODO
maybe override do_beginning do_end
=head1 SEE ALSO
L, L
TODO: a corpus of sample Pod input and HTML output? Or common
idioms?
=head1 SUPPORT
Questions or discussion about POD and Pod::Simple should be sent to the
pod-people@perl.org mail list. Send an empty email to
pod-people-subscribe@perl.org to subscribe.
This module is managed in an open GitHub repository,
L . Feel free to fork and contribute, or
to clone L and send patches!
Patches against Pod::Simple are welcome. Please send bug reports to
.
=head1 COPYRIGHT AND DISCLAIMERS
Copyright (c) 2002-2004 Sean M. Burke.
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
This program is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
=head1 ACKNOWLEDGEMENTS
Thanks to L for permission to use its
L site for man page links.
Thanks to L for permission to use the
site for Perl module links.
=head1 AUTHOR
Pod::Simple was created by Sean M. Burke .
But don't bother him, he's retired.
Pod::Simple is maintained by:
=over
=item * Allison Randal C
=item * Hans Dieter Pearcey C
=item * David E. Wheeler C
=back
=cut