Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
use strict; use warnings; use Pod::Simple::HTML; use Getopt::Long; my $add_titlebars=1; # show title bars? { package Pod_To_HTML; use base 'Pod::Simple::HTML'; # the default doesnt have long enough max_content_length. sub run { my $self=shift; delete $self->{Pod_To_HTML}{title}; $self->SUPER::run(@_); } sub get_title { my $self=shift; if (!exists $self->{Pod_To_HTML}{title}) { $self->{Pod_To_HTML}{title}= $self->_get_titled_section( 'NAME', max_token => 50, desperate => 1, max_content_length=>256, @_) ; } return $self->{Pod_To_HTML}{title}; } sub get_title_bar_text { my $text=shift->get_title(); ($text= <<"EOFTEXT")=~s/^#\s+//mg; return $text; <table border="0" width="100%" cellspacing="0" cellpadding="3"> <tr><td class="block" valign="middle"> <big><strong><span class="block">&nbsp;$text</span></strong></big> </td></tr> </table> EOFTEXT } sub do_middle { my $self=shift; my $fh = $self->output_fh; my $title_text= $add_titlebars ? $self->get_title_bar_text() : ""; print $fh $title_text; my $ret= $self->SUPER::do_middle(); print $fh $title_text; $ret } } my $toc= 1; (my $css= $0)=~s/\.[^.]+$/.css/; $css="" if !-e $css; GetOptions( "css=s" => \$css, "toc!" => \$toc, "titlebars!"=> \$add_titlebars, ) or die <<'END_OF_USAGE'; pod_to_html.pl [--css=FILESPEC] [--notoc] [PODFILE [HTMLFILE]] --css: If FILESPEC is 'auto' then tries to find the CSS based on the value of $^X. Currently 'auto' is only useful on Win32 ActiveState perls. If no value is provided and there exists a pod_to_html.css file in the same directory as the script is running from then it defaults to using that. --notoc: Turn off the Table Of Contents at the top. --notitlebars: Turn off the title header and footer lines If PODFILE is omitted reads from STDIN, if HTMLFILE is omitted writes to STDOUT. END_OF_USAGE if ( $css eq 'auto' ){ $css=""; if ( $^O eq 'MSWin32' && $css=~s/\\bin\\perl\.exe$// ) { $css.="/html/Active.css"; if ( ! -e $css ) { $css=""; } } warn "Failed to autodetect 'css' location on '$^O' with exe '$^X'\ +n"; } if ( $css!~m<^[a-z]{3,5}://> ) { # assume its a file $css=~s!\\!/!g; $css= "file://$css"; } my $parser=Pod_To_HTML->new(); $parser->index(1) if $toc; $parser->html_css($css) if $css; $parser->parse_from_file(@ARGV); exit(0);

In reply to pod_to_html.pl by demerphq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 23:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found