File: go-perl-make-pod-html.pl

package info (click to toggle)
libgo-perl 0.15-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,112 kB
  • sloc: perl: 13,147; sh: 21; makefile: 7
file content (44 lines) | stat: -rwxr-xr-x 1,334 bytes parent folder | download | duplicates (8)
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
#!/usr/bin/perl -w
use strict;

while (<>) {
    chomp;
    my $f = $_;
    my @path = split(/\//, $f);
    my $lf = pop @path;
    next unless $lf;
    if ($lf =~ /(.*)\.(\S+)$/) {
        my $n = $1;
        my $sfx = $2;
        if ($sfx eq 'pm' || $sfx eq 'pl' || $sfx eq 'pod') {
            print STDERR "Making pod for $lf\n";
            my $dir = join('/', 'pod', @path);
            my $title = 
              join('::',@path,$n);
            `mkdir -p $dir` unless -d $dir;
            my $outf = $dir . '/'. $n . '.html';
            my $tmpf = "tmp";
            open(OF,">$tmpf") || die ("can't open $tmpf");
            open(F, $f) || die ("cannot open file:$f");
            while(<F>) {
                s/L\<(map2slim|go2\w+|\w+)(\.pl|)\>/L\<scripts::$1\>/g;
                print OF $_;
            }
            close(F);
            close(OF);
            system("pod2html --htmlroot /dev/pod --title $title $tmpf > $outf");
        }
    }
    elsif (@path && $path[-1] eq 'scripts') {
        print STDERR "Making pod for $lf\n";
        my $dir = join('/', 'pod', @path);
        my $title = 
          join('::',@path,$lf);
        `mkdir -p $dir` unless -d $dir;
        my $outf = $dir . '/'. $lf . '.html';
        system("pod2html --htmlroot /dev/pod --title $title $f > $outf");

    }
    else {
    }
}