Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

ActivePerl::DocTools::TOC::HTML::Podmaster

by PodMaster (Abbot)
on Oct 28, 2002 at 17:12 UTC ( [id://208555]=sourcecode: print w/replies, xml ) Need Help??
Category: Pod Utility
Author/Contact Info /msg podmaster
Description: This is the ActivePerl::DocTools generated TOC according to podmaster.
Now you can hit Ctrl-F in your browser, and type in Data::Dumper and actually find it.

Still looks pretty ;)

Download a tarball here

update: For those of you who don't know how pretty it looks, check this out ;D

update: evil

package ActivePerl::DocTools::TOC::HTML::Podmaster;
use strict;
use warnings;

use ActivePerl::DocTools::TOC::HTML;
use base qw( ActivePerl::DocTools::TOC::HTML );
our $VERSION = 0.01;

# The ActivePerl guys commented out the pod for ActivePerl::DocTools, 
+thus
# making things ugly, so I gots to fix that
sub new {
    my $self = shift;
    $self = $self->SUPER::new(@_);
    $self->{'filez'}->{'ActivePerl'}='' unless exists $self->{'filez'}
+->{'ActivePerl'};
    $self->{'filez'}->{'ActivePerl::DocTools'}='' unless exists $self-
+>{'filez'}->{'ActivePerl::DocTools'};
    $self->{'filez'}->{'ActivePerl::DocTools::TOC'}='' unless exists $
+self->{'filez'}->{'ActivePerl::DocTools::TOC'};
    return $self;    
}


sub boilerplate {q[
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<head>
<title>ActivePerl User Guide - Table of Contents</title>
<base target="PerlDoc">
<style type="text/css">

.blend {
    color: #FFFFFF;
    font-weight: normal; 
}

.padround {
    font-weight: bold;
    padding-right: 1px;
}
</style>

<link rel="STYLESHEET" href="Active.css" type="text/css">
</head>

<body>

<h1>Table of Contents</h1>

<div nowrap>

]. ( exists $_[0]->{"\0_boiler_links"} ? $_[0]->boiler_links() : "" ) 
+}

sub library {
    my( $self, $modulename, $turnIntoLink) = @_;
    my $depth = "&nbsp;" x 2;
    if( $modulename =~ /::/ ) {
        $depth .= $modulename;
        $depth =~ s{(.*?)::$turnIntoLink}{<span class="blend">$1</span
+><span class="padround">::</span>};
        return $depth.qq[<a href="$self->{filez}->{$modulename}">$turn
+IntoLink</a><br>];
    }
    return _folder(qq[<a href="$self->{filez}->{$modulename}">$turnInt
+oLink</a>]);
    
}

sub library_container {
#    warn "\n\nlibrary_container\n", sprintf join("\n",map{'%s'}1..@_)
+ ,@_;
    my ($self, $module, $show, $depth) = @_;

    $depth = "";
        
    if( $module =~ /::/ ) {
        $depth = "&nbsp;&nbsp;$module";
        $depth =~ s/^(.*?)::$show$/$1/;
        $depth = qq[<b class="blend">$depth</b>];
    }
    return  $depth._folder($show);
}


sub _folder {
    my ($text) = @_;
    defined $text or die "no argument to _folder!";
    return qq'<img src="images/greysmallbullet.gif" width="5" height="
+5" alt="*"> $text<br>\n';
}

our $dirbase = $ActivePerl::DocTools::TOC::dirbase;
*main::WriteTOC = \&WriteTOC; # forget Exporter

sub WriteTOC {
    my $fh;
    unless (open $fh, '>', "$dirbase/perltoc.html") {
    warn "Unable to open $dirbase/perltoc.html for writing: $!\n";
    return undef;
    }

    my $html_toc = ActivePerl::DocTools::TOC::HTML::Podmaster->new();
    $html_toc->{"\0_boiler_links"} = 1 if @_; 
    print $fh $html_toc->TOC();
}


1;

=head1 NAME

ActivePerl::DocTools::TOC::HTML::Podmaster - better TOC than standard

=head1 SYNOPSIS

    perl -MActivePerl::DocTools -e UpdateHTML()
    perl -MActivePerl::DocTools::TOC::HTML::Podmaster -e WriteTOC()

    perl -MActivePerl::DocTools -e UpdateHTML()
    perl -MActivePerl::DocTools::TOC::HTML::Podmaster -e WriteTOC(1)

If you pass 1 to WriteTOC ActivePerl FAQ and Windows Scripting
part of the toc will also be printed (I avoid these ;)

=head1 DESCRIPTION

This is the ActivePerl::DocTools generated TOC according to podmaster.
Now you can hit Ctrl-F in your browser, and type in Data::Dumper
and actually find it.

Still looks pretty ;)

=head1 AUTHOR

podmaster of perlmonks.org fame

=head1 SEE ALSO

The sourcecode to ActivePerl::DocTools::TOC, ActivePerl::DocTools::TOC
+::HTML

=cut

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: sourcecode [id://208555]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-16 17:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found