Gentoo Archives: gentoo-docs-it

From: Gianni Costanzi <gianni.costanzi@×××××.com>
To: gentoo-docs-it@l.g.o
Subject: [gentoo-docs-it] Lista documenti da aggiornare non aggiornata :)
Date: Wed, 07 Feb 2007 14:30:59
Message-Id: 671355fe0702070630k5315b536h8bebde851194f90e@mail.gmail.com
Ciao,
volevo sapere come mai non viene più mantenuta aggiornata la
comodissima lista con i documenti da aggiornare che si trova su
http://dev.gentoo.org/~so/trads-it.html
Magari è stata rimpiazzata da qualcos'altro e non ne sono al
corrente.... a me risulta piuttosto comoda, quindi se fosse possibile
aggiornarla ogni tanto sarebbe una bella cosa :)

Se puo' essere utile, con lo script che riporto di seguito è possibile
scaricare la pagina sul proprio PC con solo le righe nella tabella che
riguardano i miei articoli.. andrebbe rifinito per rimuovere altre
parti inutili ma non ho tempo al momento :) Basta modificare le
variabili OUTPUT_FILE e AUTHOR_NAME :)

************************************************************************************

#!/usr/bin/perl -w

#Copyright (C) 2006, Gianni Costanzi (gianni.costanzi@×××××.com)

#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

use LWP;
use POSIX qw /:sys_wait_h floor/;

$OUTPUT_FILE = "/home/gianni/GentooDocs/trads-it.html";
$AUTHOR_NAME = "Gianni Costanzi";

sub print_usage {
        print "\nUsage: parse-trads.pl [--copyright]\n\n";
}

sub cmdline_error {
        print $_[0] . "\n";
        print_usage;

        exit -1;
}

sub print_copyright {
        print <<COPYRIGHT

        Copyright (C) 2006, Gianni Costanzi (gianni.costanzi\@gmail.com)

        This program is free software; you can redistribute it and/or modify it
        under the terms of the GNU General Public License as published by the
        Free Software Foundation; either version 2 of the License, or (at your
        option) any later version.

        This program is distributed in the hope that it will be useful, but
        WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
        General Public License for more details.

        You should have received a copy of the GNU General Public License along
        with this program; if not, write to the Free Software Foundation, Inc.,
        51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

COPYRIGHT
}

print "Copyright (C) 2006, Gianni Costanzi (gianni.costanzi\@gmail.com).\n";
print "Released under GPL v.2 or later.\n\n";

# Read command line option into an associative array
for ($i = 0; $i < @ARGV; $i++) {
        if ( $ARGV[$i] =~ /--copyright/ ) {
                print_copyright;
                exit 0;
        } elsif ( $ARGV[$i] =~ /--help/ ) {
                print_usage;
                exit 0;
        }
}

$first = 2;

$ua = LWP::UserAgent->new;
$ua->timeout(30);
$ua->env_proxy;

$response = $ua->get("http://dev.gentoo.org/~so/trads-it.html");

$response = $response->content;

open(OUT,">$OUTPUT_FILE") || die "Unable to create output file!";

while ($response =~ /([^\n]+\n)/g) {
        $_ = $1;
        if (/<tr>/ && $first > 0) {
                while($response =~ /([^\n]+\n)/g) {
                        $_ = $1;
                        print OUT;
                        if (/<\/tr>/) {
                                $first--;
                                last;
                        }
                }
        } elsif (/<tr>/) {
                $found = 0;
                $line = $_;
                while ($response =~ /([^\n]+\n)/g) {
                        $_ = $1;
                        if (/<\/tr>/) {
                                if ($found == 0) {
                                        last;
                                } else {
                                        $line = $line . " " . $_;
                                        print OUT $line;
                                        last;
                                }
                        } else {
                                if (/$AUTHOR_NAME/) {
                                        $found = 1;
                                }
                                $line = $line . " " . $_;
                        }
                }
        } else {
                print OUT;
        }
}


************************************************************************************

-- 
--------------------------------------------------------------------------------------------------------------
|  Gianni Costanzi (gianni.costanzi@×××××.com)
|       (http://utenti.lycos.it/giannicostanzi/)
|
|  Gentoo Documentation Project (GDP) Member - Italian Translator
|       (http://www.gentoo.org/proj/en/gdp/)
|
|  Free Software Foundation Member #3844 (www.fsf.org)
|
|  Sun Valley in Rock Staff Member (www.sunvalleyinrock.net [/forum])
--------------------------------------------------------------------------------------------------------------

Replies

Subject Author
Re: [gentoo-docs-it] Lista documenti da aggiornare non aggiornata :) Marco Mascherpa <m.mascherpa@g.o>