aboutsummaryrefslogtreecommitdiffstats
path: root/docs/buildpod.pl
blob: 050ea8e2172ade8e834c53d31cd166f528be397b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env perl

use strict;
use warnings;

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->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",
                     " &copy; 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;

use File::Copy;

my $output_dir = "../../tmp/shab-irssi-scripts/docs/";
my $batchconv = Pod::Simple::HTMLBatch::Custom->new;
my $css = 'podstyle.css';

$batchconv->add_css('podstyle.css', 1);

$batchconv->batch_convert([qw/./], $output_dir);
print "Copying CSS...\n";
copy($css, $output_dir . $css);
print "Done\n";