Re: how is the html on search.cpan.org generated?

[email protected] (John McNamara)
Newsgroups perl.pod-people
Message-ID <[email protected]>
On Tue, Oct 20, 2009 at 2:19 PM, Mitch Gower
<[email protected]>wrote:

>
> The pod to html conversion used on search.cpan.org seems to produce quite
> nice output.  What tool is being used there, and is it publicly
> available?  I couldn't see any evidence in the html itself of what's being
> used.
>
>
Hi,

AFAIK, it is produced using Pod::Simple::Html. The "niceness" comes from the
CSS for the site.

Here is a small a small filter program that produces similar output:

    #!/usr/bin/perl -w

    use strict;
    use Pod::Simple::HTML;

    my $parser = Pod::Simple::HTML->new();

    if (defined $ARGV[0]) {
        open IN, $ARGV[0]  or die "Couldn't open $ARGV[0]: $!\n";
    } else {
        *IN = *STDIN;
    }

    if (defined $ARGV[1]) {
        open OUT, ">$ARGV[1]" or die "Couldn't open $ARGV[1]: $!\n";
    } else {
        *OUT = *STDOUT;
    }

    $parser->index(1);
    $parser->html_css('http://search.cpan.org/s/style.css');

    $parser->output_fh(*OUT);
    $parser->parse_file(*IN);

    __END__


You can run it as follows:

    perl pod2cpanhtml.pl Module.pm > module.html


John.
--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.