.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.47) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "Pod::Simple::HTML 3" .TH Pod::Simple::HTML 3 2025-07-25 "perl v5.42.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Pod::Simple::HTML \- convert Pod to HTML .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& perl \-MPod::Simple::HTML \-e Pod::Simple::HTML::go thingy.pod .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This class is for making an HTML rendering of a Pod document. .PP This is a subclass of Pod::Simple::PullParser and inherits all its methods (and options). .PP Note that if you want to do a batch conversion of a lot of Pod documents to HTML, you should see the module Pod::Simple::HTMLBatch. .SH "CALLING FROM THE COMMAND LINE" .IX Header "CALLING FROM THE COMMAND LINE" TODO .PP .Vb 1 \& perl \-MPod::Simple::HTML \-e Pod::Simple::HTML::go Thing.pod Thing.html .Ve .SH "CALLING FROM PERL" .IX Header "CALLING FROM PERL" .SS "Minimal code" .IX Subsection "Minimal code" .Vb 6 \& use Pod::Simple::HTML; \& my $p = Pod::Simple::HTML\->new; \& $p\->output_string(\emy $html); \& $p\->parse_file(\*(Aqpath/to/Module/Name.pm\*(Aq); \& open my $out, \*(Aq>\*(Aq, \*(Aqout.html\*(Aq or die "Cannot open \*(Aqout.html\*(Aq: $!\en"; \& print $out $html; .Ve .SS "More detailed example" .IX Subsection "More detailed example" .Vb 1 \& use Pod::Simple::HTML; .Ve .PP Set the content type: .PP .Vb 1 \& $Pod::Simple::HTML::Content_decl = q{}; \& \& my $p = Pod::Simple::HTML\->new; .Ve .PP Include a single javascript source: .PP .Vb 1 \& $p\->html_javascript(\*(Aqhttp://abc.com/a.js\*(Aq); .Ve .PP Or insert multiple javascript source in the header (or for that matter include anything, thought this is not recommended) .PP .Vb 3 \& $p\->html_javascript(\*(Aq \& \& \*(Aq); .Ve .PP Include a single css source in the header: .PP .Vb 1 \& $p\->html_css(\*(Aq/style.css\*(Aq); .Ve .PP or insert multiple css sources: .PP .Vb 3 \& $p\->html_css(\*(Aq \& \& \*(Aq); .Ve .PP Tell the parser where should the output go. In this case it will be placed in the \f(CW$html\fR variable: .PP .Vb 2 \& my $html; \& $p\->output_string(\e$html); .Ve .PP Parse and process a file with pod in it: .PP .Vb 1 \& $p\->parse_file(\*(Aqpath/to/Module/Name.pm\*(Aq); .Ve .SH METHODS .IX Header "METHODS" TODO all (most?) accessorized methods .PP The following variables need to be set \fBbefore\fR the call to the \->new constructor. .PP Set the string that is included before the opening tag: .PP .Vb 2 \& $Pod::Simple::HTML::Doctype_decl = qq{\en}; .Ve .PP Set the content\-type in the HTML head: (defaults to ISO\-8859\-1) .PP .Vb 1 \& $Pod::Simple::HTML::Content_decl = q{}; .Ve .PP Set the value that will be embedded in the opening tags of F, C tags and verbatim text. F maps to , C maps to , Verbatim text maps to
 (Computerese defaults to "")
.PP
.Vb 1
\&  $Pod::Simple::HTML::Computerese =  \*(Aq class="some_class_name\*(Aq;
.Ve
.SS html_css
.IX Subsection "html_css"
.SS html_javascript
.IX Subsection "html_javascript"
.SS title_prefix
.IX Subsection "title_prefix"
.SS title_postfix
.IX Subsection "title_postfix"
.SS html_header_before_title
.IX Subsection "html_header_before_title"
This includes everything before the  opening tag including the Document type
and including the opening <title> tag. The following call will set it to be a simple HTML
file:
.PP
.Vb 1
\&  $p\->html_header_before_title(\*(Aq<html><head><title>\*(Aq);
.Ve
.SS top_anchor
.IX Subsection "top_anchor"
By default Pod::Simple::HTML adds a dummy anchor at the top of the HTML.
You can change it by calling
.PP
.Vb 1
\&  $p\->top_anchor(\*(Aq<a name="zz" >\*(Aq);
.Ve
.SS html_h_level
.IX Subsection "html_h_level"
Normally =head1 will become <h1>, =head2 will become <h2> etc.
Using the html_h_level method will change these levels setting the h level
of =head1 tags:
.PP
.Vb 1
\&  $p\->html_h_level(3);
.Ve
.PP
Will make sure that =head1 will become <h3> and =head2 will become <h4> etc...
.SS index
.IX Subsection "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.
.PP
.Vb 1
\&  $p\->index(1);
.Ve
.SS html_header_after_title
.IX Subsection "html_header_after_title"
Includes the closing tag of  and through the rest of the head
till the opening of the body
.PP
.Vb 1
\&  $p\->html_header_after_title(\*(Aq...\*(Aq);
.Ve
.SS html_footer
.IX Subsection "html_footer"
The very end of the document:
.PP
.Vb 1
\&  $p\->html_footer( qq[\en\en\en\en] );
.Ve
.SH SUBCLASSING
.IX Header "SUBCLASSING"
Can use any of the methods described above but for further customization
one needs to override some of the methods:
.PP
.Vb 3
\&  package My::Pod;
\&  use strict;
\&  use warnings;
\&
\&  use base \*(AqPod::Simple::HTML\*(Aq;
\&
\&  # 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(\*(Aqto\*(Aq);       #
\&    say $link\->attr(\*(Aqtype\*(Aq);     # will be \*(Aqpod\*(Aq always
\&    say $link\->attr(\*(Aqsection\*(Aq);
\&
\&    # Links local to our web site
\&    if ($link\->tagname eq \*(AqL\*(Aq and $link\->attr(\*(Aqtype\*(Aq) eq \*(Aqpod\*(Aq) {
\&      my $to = $link\->attr(\*(Aqto\*(Aq);
\&      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;
.Ve
.PP
Meanwhile in script.pl:
.PP
.Vb 1
\&  use My::Pod;
\&
\&  my $p = My::Pod\->new;
\&
\&  my $html;
\&  $p\->output_string(\e$html);
\&  $p\->parse_file(\*(Aqpath/to/Module/Name.pm\*(Aq);
\&  open my $out, \*(Aq>\*(Aq, \*(Aqout.html\*(Aq or die;
\&  print $out $html;
.Ve
.PP
TODO
.PP
maybe override do_beginning do_end
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Pod::Simple, Pod::Simple::HTMLBatch
.PP
TODO: a corpus of sample Pod input and HTML output?  Or common
idioms?
.SH SUPPORT
.IX Header "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.
.PP
This module is managed in an open GitHub repository,
. Feel free to fork and contribute, or
to clone  and send patches!
.PP
Patches against Pod::Simple are welcome. Please send bug reports to
.
.SH "COPYRIGHT AND DISCLAIMERS"
.IX Header "COPYRIGHT AND DISCLAIMERS"
Copyright (c) 2002\-2004 Sean M. Burke.
.PP
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
.PP
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.
.SH AUTHOR
.IX Header "AUTHOR"
Pod::Simple was created by Sean M. Burke .
But don\*(Aqt bother him, he\*(Aqs retired.
.PP
Pod::Simple is maintained by:
.IP \(bu 4
Allison Randal \f(CW\*(C`allison@perl.org\*(C'\fR
.IP \(bu 4
Hans Dieter Pearcey \f(CW\*(C`hdp@cpan.org\*(C'\fR
.IP \(bu 4
David E. Wheeler \f(CW\*(C`dwheeler@cpan.org\*(C'\fR