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
1 Ciao,
2 volevo sapere come mai non viene più mantenuta aggiornata la
3 comodissima lista con i documenti da aggiornare che si trova su
4 http://dev.gentoo.org/~so/trads-it.html
5 Magari è stata rimpiazzata da qualcos'altro e non ne sono al
6 corrente.... a me risulta piuttosto comoda, quindi se fosse possibile
7 aggiornarla ogni tanto sarebbe una bella cosa :)
8
9 Se puo' essere utile, con lo script che riporto di seguito è possibile
10 scaricare la pagina sul proprio PC con solo le righe nella tabella che
11 riguardano i miei articoli.. andrebbe rifinito per rimuovere altre
12 parti inutili ma non ho tempo al momento :) Basta modificare le
13 variabili OUTPUT_FILE e AUTHOR_NAME :)
14
15 ************************************************************************************
16
17 #!/usr/bin/perl -w
18
19 #Copyright (C) 2006, Gianni Costanzi (gianni.costanzi@×××××.com)
20
21 #This program is free software; you can redistribute it and/or modify
22 #it under the terms of the GNU General Public License as published by
23 #the Free Software Foundation; either version 2 of the License, or
24 #(at your option) any later version.
25 #
26 #This program is distributed in the hope that it will be useful,
27 #but WITHOUT ANY WARRANTY; without even the implied warranty of
28 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 #GNU General Public License for more details.
30 #
31 #You should have received a copy of the GNU General Public License
32 #along with this program; if not, write to the Free Software
33 #Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34
35 use LWP;
36 use POSIX qw /:sys_wait_h floor/;
37
38 $OUTPUT_FILE = "/home/gianni/GentooDocs/trads-it.html";
39 $AUTHOR_NAME = "Gianni Costanzi";
40
41 sub print_usage {
42 print "\nUsage: parse-trads.pl [--copyright]\n\n";
43 }
44
45 sub cmdline_error {
46 print $_[0] . "\n";
47 print_usage;
48
49 exit -1;
50 }
51
52 sub print_copyright {
53 print <<COPYRIGHT
54
55 Copyright (C) 2006, Gianni Costanzi (gianni.costanzi\@gmail.com)
56
57 This program is free software; you can redistribute it and/or modify it
58 under the terms of the GNU General Public License as published by the
59 Free Software Foundation; either version 2 of the License, or (at your
60 option) any later version.
61
62 This program is distributed in the hope that it will be useful, but
63 WITHOUT ANY WARRANTY; without even the implied warranty of
64 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
65 General Public License for more details.
66
67 You should have received a copy of the GNU General Public License along
68 with this program; if not, write to the Free Software Foundation, Inc.,
69 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
70
71 COPYRIGHT
72 }
73
74 print "Copyright (C) 2006, Gianni Costanzi (gianni.costanzi\@gmail.com).\n";
75 print "Released under GPL v.2 or later.\n\n";
76
77 # Read command line option into an associative array
78 for ($i = 0; $i < @ARGV; $i++) {
79 if ( $ARGV[$i] =~ /--copyright/ ) {
80 print_copyright;
81 exit 0;
82 } elsif ( $ARGV[$i] =~ /--help/ ) {
83 print_usage;
84 exit 0;
85 }
86 }
87
88 $first = 2;
89
90 $ua = LWP::UserAgent->new;
91 $ua->timeout(30);
92 $ua->env_proxy;
93
94 $response = $ua->get("http://dev.gentoo.org/~so/trads-it.html");
95
96 $response = $response->content;
97
98 open(OUT,">$OUTPUT_FILE") || die "Unable to create output file!";
99
100 while ($response =~ /([^\n]+\n)/g) {
101 $_ = $1;
102 if (/<tr>/ && $first > 0) {
103 while($response =~ /([^\n]+\n)/g) {
104 $_ = $1;
105 print OUT;
106 if (/<\/tr>/) {
107 $first--;
108 last;
109 }
110 }
111 } elsif (/<tr>/) {
112 $found = 0;
113 $line = $_;
114 while ($response =~ /([^\n]+\n)/g) {
115 $_ = $1;
116 if (/<\/tr>/) {
117 if ($found == 0) {
118 last;
119 } else {
120 $line = $line . " " . $_;
121 print OUT $line;
122 last;
123 }
124 } else {
125 if (/$AUTHOR_NAME/) {
126 $found = 1;
127 }
128 $line = $line . " " . $_;
129 }
130 }
131 } else {
132 print OUT;
133 }
134 }
135
136
137 ************************************************************************************
138
139 --
140 --------------------------------------------------------------------------------------------------------------
141 | Gianni Costanzi (gianni.costanzi@×××××.com)
142 | (http://utenti.lycos.it/giannicostanzi/)
143 |
144 | Gentoo Documentation Project (GDP) Member - Italian Translator
145 | (http://www.gentoo.org/proj/en/gdp/)
146 |
147 | Free Software Foundation Member #3844 (www.fsf.org)
148 |
149 | Sun Valley in Rock Staff Member (www.sunvalleyinrock.net [/forum])
150 --------------------------------------------------------------------------------------------------------------

Replies

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