diff options
author | Tom Feist <shabble@cowu.be> | 2010-08-22 16:13:35 +0000 |
---|---|---|
committer | Tom Feist <shabble@cowu.be> | 2010-08-22 16:13:35 +0000 |
commit | 24e48ff237a5f200ed3e36a660ee920583ab49ca (patch) | |
tree | a8ae05bed1e0a57485526e92b56e9649010edc23 /docs/buildpod.pl | |
parent | oh god stupid git. Well, also my fault for committing the wrong thing. (diff) | |
download | irssi-scripts-24e48ff237a5f200ed3e36a660ee920583ab49ca.tar.gz irssi-scripts-24e48ff237a5f200ed3e36a660ee920583ab49ca.zip |
moved some stuff into General, and started to modify buildpod.pl to render a better index page.
Diffstat (limited to 'docs/buildpod.pl')
-rwxr-xr-x | docs/buildpod.pl | 87 |
1 files changed, 80 insertions, 7 deletions
diff --git a/docs/buildpod.pl b/docs/buildpod.pl index 816b6e0..ce2b2aa 100755 --- a/docs/buildpod.pl +++ b/docs/buildpod.pl @@ -3,15 +3,88 @@ use strict; use warnings; -use Pod::Simple::HTMLBatch; -use File::Find; +package Pod::Simple::HTMLBatch::Custom; +use base qw/Pod::Simple::HTMLBatch/; + +use vars qw/$VERSION/; + +$VERSION = '0.01'; +sub esc { + return Pod::Simple::HTMLBatch::esc(@_); +} + +sub new { + print "Hello!\n"; + my $self = shift; + my $obj = $self->SUPER::new(@_); + + $obj->add_css('podstyle.css', 1); + $obj->css_flurry(0); + $obj->javascript_flurry(0); + + + my @index_header = ("<html>\n", + "<head>\n", + "<title>Irssi Scripting Documentation</title>\n", + "</head><body class='contentspage'>\n", + "<h1>Irssi Scripting Documentation</h1>\n", + ); + + $obj->contents_page_start(join("", @index_header)); + + + my $index_footer = sprintf("\n\n<p class='contentsfooty'>Generated " + . "by %s v%s under Perl v%s\n<br >At %s GMT" + . ", which is %s local time.</p>\n\n</body></html>\n", + esc(ref($obj), $VERSION, + $], scalar(gmtime), scalar(localtime))); + + + my @copyright = ( + "<p><small>Much of the content on these pages is taken", + " from original Irssi documentation, and is Copyright", + " © 2000-2010 The Irssi project.<br/>", + " Formatting and additional documentation by Tom Feist", + " <code>shabble+irssi\@metavore.org</code>", + "</small></p>"); + + $obj->contents_page_end($index_footer . join("", @copyright)); + + return $obj; +} + + + +sub _write_contents_middle { + my($self, $Contents, $outfile, $toplevel2submodules, $toplevel_form_freq) = @_; + + foreach my $t (sort keys %$toplevel2submodules) { + my @downlines = sort {$a->[-1] cmp $b->[-1]} + @{ $toplevel2submodules->{$t} }; + + printf $Contents qq[<dt><a name="%s">%s</a></dt>\n<dd>\n], + esc( $t, $toplevel_form_freq->{$t} ) ; + + my($path, $name); + foreach my $e (@downlines) { + $name = $e->[0]; + $path = join( "/", '.', esc( @{$e->[3]} ) ) + . ($POD::Simple::HTMLBatch::HTML_EXTENSION + || $Pod::Simple::HTML::HTML_EXTENSION); + print $Contents qq{ <a href="$path">}, esc($name), "</a><br/>\n"; + } + print $Contents "</dd>\n\n"; + } + return 1; +} + +1; + +package main; my $output_dir = "../../tmp/shab-irssi-scripts/docs/"; -my $batchconv = Pod::Simple::HTMLBatch->new; -$batchconv->add_css('podstyle.css', 1); -$batchconv->css_flurry(0); -$batchconv->javascript_flurry(0); +my $batchconv = Pod::Simple::HTMLBatch::Custom->new; -$batchconv->batch_convert( [qw/./], $output_dir ); +$batchconv->batch_convert([qw/./], $output_dir); |