Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Piatok, 29. marec 2024

Súbor: [Platon] / iotta / Iotta / Input / NavGen.pm (stiahnutie)

Revízia 1.1, Sun Feb 16 15:48:12 2003 UTC (21 years, 1 month ago) by yenar

Initial revision

package Iotta::Input::NavGen;
use strict;
require Iotta::Elem;
our @ISA = ("Iotta::Elem");

sub trim {
    my $i = shift;
    $i =~ s/^[ \t\n]+//;
    $i =~ s/[ \t\n]+$//;
    return $i;
}

sub run {
    my $self = shift;
    my $m = shift;
    my $d = shift;
    $self->next->run ($m, $d) if ($self->next);
    push @{$self->files}, $m;
    return 0;
}

sub setup {
    my $s = shift;
    my $o = shift;
    #$s->chain->mod_creat ("test");
    $s->categ ($s->chain->mod_creat ($$o{categorizer}));
}

sub finish {
    my $s = shift;
    # build index list using categorizer
    my $indexes = $s->categ->sort ($s->files);
    # format the indexes into text files and process these
    for my $a (@$indexes) {
        my $d;
        for (@{$$a{files}}) {
            $d .= "L ".$$_{relname}."\n";
            $d .= "T ".$$_{title}."\n\n";
        }
        $$a{format} = "index";
        $$a{top} = '.';
        $s->next->run ($a, $d) if ($s->next);
    }
    my %sidx;
    my $d;
    for (@$indexes) {
        $d .= "L ".$$_{relname}."\n";
        $d .= "T ".$$_{title}."\n\n";
    }
    $sidx{format} = "index";
    $sidx{input} = "categories";
    $sidx{title} = "category index";
    $sidx{top} = '.';
    $s->next->run (\%sidx, $d) if ($s->next);
}

sub initialize {
    my $self = shift;
    my @files;
    $self->SUPER::initialize (@_);
    $self->{files} = \@files;
    $self->{categ} = 0;
}

1;

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok