Top bar
2005/1/4
Bonne fête aux Odilon !

I'm aware of the made up declarations about me that have recently begun to appear on the Internet and in emails as "Chuck Norris facts." I've seen some of them. Some are funny. Some are pretty far out. Being more a student of the Wild West than the wild world of the Internet, I'm not quite sure what to make of it. It's quite surprising. I do know that boys will be boys, and I neither take offense nor take these things too seriously. Who knows, maybe these made up one-liners will prompt young people to seek out the real facts as found in my recent autobiographical book, "Against All Odds?" They may even be interested enough to check out my novels set in the Old West, "The Justice Riders," released this month. I'm very proud of these literary efforts.
Chuck Norris

gnuRSS

Filed under: Prog — admin @ 22:30:00

Bon, puisque les RSS me plaisent tant, j’ai décidé d’appliquer ce concept a la page de nouveautés de GNUArt.
Après une courte lutte, je suis finalement parvenu a concevoir la moulinette que voici en Perl. Je vous la livre telle quelle, elle ne devrait pas se révéler trop difficile à traffiquer :

#!c:/Programme/Perl/bin/perl
use POSIX;
open (IN, "<nouveautes.html") or die "!?n";
open (OUT, ">gnuart.rss") or die "?!n";
my ( $date, $misc, $url, $categorie, $auteur, $catalog, $title, $pubdate, $year, $month, $day, $time_t, $mo, $i );
$date = $misc = $url = $categorie = $auteur = $catalog = $title = $pubdate = $year = $month = $day = $time_t = $mo = $i = 0;
$pubdate = localtime;
print OUT <<EOF;
<rss version="2.0">
        <channel>
                <title>GNUArt.net</title>
                <link>http://gnuart.net</link>
                <description>GNUArt - Nouvelles de la Galerie</description>
                <copyright>No Copyright</copyright>
                <pubDate>$pubdate</pubDate>
                <generator>rss.pl</generator>
EOF
while (<IN>) {
  if ( m/<li>/i ) {
    s/(<br>|&nbsp;|s{2,})/ /gi;
    foreach $mo ( "eacute", "agrave", "egrave", "ccedil", "ecirc", "ucirc", "acirc", "auml", "euml", "iuml", "iacute", "icirc", "oacute", "ocirc", "ouml", "ugrave", "ucirc", "yuml" ) {
      $i = substr($mo, 0, 1);
      s/.$mo./$i/g;
    }
    s#<strong>([^s]+ [^s]+ [^&]+) :</strong>((.*)<a href="http://([w.]*)gnuart.net/data/([^"]+).*)# ( $date = $1 ) . ( $message=$2 ) .( $misc=$3 ) . ( $url=$5 ) #ei;
    $url =~ s#/index.html*## ;
    ($categorie, $auteur, $catalog ) = split ///, $url;
    ($day, $month, $year) = split / /, $date;
    $i = 0;use POSIX;
    foreach $mo ('ja', 'f', 'mar', 'avr', 'mai', 'juin', 'juil', 'a', 's', 'o', 'n', 'd' ) {
        if ( $month =~ m/^$mo/i ) {
          last;
      } else {
          $i++;
      }
    }
    $time_t = POSIX::mktime( 0, 0, 0, $day, $i, $year - 1900 );
    $title = POSIX::ctime($time_t);
    print OUT<<EOF;
                <item>
                        <title>$date</title>
                        <link>http://gnuart.net/data/$url</link>
                        <pubDate>$title</pubDate>
                        <category>$categorie</category>
                        <description>
$message 
                        </description>
                </item>
EOF
    $date = $misc = $url = $categorie = $auteur = $catalog = "";
  }
}
close (IN);
print OUT<<EOF;
        </channel>
</rss>
EOF
close (OUT);

Merci à Habett pour son aide précieuse (visitez son site .COM !) et pour m’avoir tuyauté quant au génial Validateur XML du W3 !

Bon, le script a encore été modifié, le mieux est que vous alliez le chercher ici




Webcam@Berninfo.ch




Powered by WordPress (Important Warning)