[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#297648: RSS feed for DWN



Package: www.debian.org
Severity: wishlist

There should be an RSS feed for DWN.  The attached mail contains a
script that could be used as a starting point.

-- 
Matt
From joey@infodrom.org Sat Feb 12 12:50:56 2005
Return-path: <joey@infodrom.org>
Envelope-to: kraai@localhost
Delivery-date: Sat, 12 Feb 2005 12:50:56 -0800
Received: from localhost ([127.0.0.1] ident=kraai)
	by localhost.localdomain with esmtp (Exim 4.34)
	id 1D04E9-0000v9-2d
	for kraai@localhost; Sat, 12 Feb 2005 12:50:56 -0800
Received: from zoon.lafn.org [206.117.18.9]
	by localhost with POP3 (fetchmail-6.2.5)
	for kraai@localhost (single-drop); Sat, 12 Feb 2005 12:50:53 -0800 (PST)
Received: from master.debian.org (master.debian.org [146.82.138.7])
	by zoon.lafn.org (8.12.3p3/8.11.3) with ESMTP id j1BH7Cxd028736
	for <kraai@lafn.org>; Fri, 11 Feb 2005 09:07:12 -0800 (PST)
	(envelope-from joey@infodrom.org)
Received: from luonnotar.infodrom.org [195.124.48.78] 
	by master.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1CzeG7-00073q-00; Fri, 11 Feb 2005 11:07:11 -0600
Received: by luonnotar.infodrom.org (Postfix, from userid 10)
	id 84442366B73; Fri, 11 Feb 2005 18:07:16 +0100 (CET)
Received: at Infodrom Oldenburg (/\##/\ Smail-3.2.0.102 1998-Aug-2 #2)
	from infodrom.org by finlandia.Infodrom.North.DE
	via smail from stdin
	id <m1CzeAM-000okmC@finlandia.Infodrom.North.DE>
	for kraai@debian.org; Fri, 11 Feb 2005 18:01:14 +0100 (CET) 
Date: Fri, 11 Feb 2005 18:01:13 +0100
From: Martin Schulze <joey@infodrom.org>
To: Matt Kraai <kraai@debian.org>
Cc: Filippo Giunchedi <filippo@esaurito.net>
Message-ID: <20050211170113.GX1666@finlandia.infodrom.north.de>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="4N42/ivucor2EeDs"
Content-Disposition: inline
User-Agent: Mutt/1.5.6+20040907i
X-Virus-Scanned: ClamAV 0.80/629/Tue Dec 14 11:01:57 2004
	clamav-milter version 0.80j
	on zoon.lafn.org
X-Virus-Status: Clean
X-UIDL: Gi8"!OfG"!'\U!!pKa!!
X-SA-Exim-Connect-IP: 127.0.0.1
X-SA-Exim-Mail-From: joey@infodrom.org
Subject: [filippo@esaurito.net: Re: RSS feed for DWN]
X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on catalunya
X-Spam-Level: 
X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham 
	version=3.0.2
X-SA-Exim-Version: 4.2 (built Tue, 25 Jan 2005 19:51:04 +0000)
X-SA-Exim-Scanned: Yes (on localhost.localdomain)
Status: RO
Content-Length: 8435
Lines: 267


--4N42/ivucor2EeDs
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline

Hi Matt,

here's an addition to get DWN converted into an RSS feed as well.
Maybe you want to adopt it to the web pages.  It would have to
be modified to use local .html or .wml files instead of wget
but that should be easy.  I haven't testet it yet.

Regards,

	Joey

-- 
The good thing about standards is that there are so many to choose from.
		-- Andrew S. Tanenbaum

--4N42/ivucor2EeDs
Content-Type: message/rfc822
Content-Disposition: inline

Return-Path: <joey@luonnotar.infodrom.org>
X-Original-To: joey@finlandia.infodrom.org
Delivered-To: joey@finlandia.infodrom.org
Received: by finlandia.infodrom.north.de (Postfix, from userid 10)
	id 8BE1EFDD5; Fri, 11 Feb 2005 17:57:12 +0100 (CET)
Received: from luonnotar (localhost [127.0.0.1])
	by finlandia.infodrom.north.de (Postfix) with SMTP id 007FBDDD5C
	for <joey@finlandia.infodrom.org>; Fri, 11 Feb 2005 17:57:11 +0100 (CET)
X-Mailbox-Line: From joey@luonnotar.infodrom.org  Fri Feb 11 17:48:33 2005
Received: by luonnotar.infodrom.org (Postfix, from userid 1001)
	id 0EBDC366B75; Fri, 11 Feb 2005 17:48:32 +0100 (CET)
X-Original-To: joey
Delivered-To: joey@luonnotar.infodrom.org
Received: by luonnotar.infodrom.org (Postfix, from userid 38)
	id 832DC366B65; Fri, 11 Feb 2005 17:48:29 +0100 (CET)
X-Original-To: bar@infodrom.org
Delivered-To: bar@luonnotar.infodrom.org
Received: from master.debian.org (master.debian.org [146.82.138.7])
	by luonnotar.infodrom.org (Postfix) with ESMTP id 0153B366B7B
	for <bar@infodrom.org>; Fri, 11 Feb 2005 17:47:46 +0100 (CET)
Received: from joey by master.debian.org with local (Exim 3.35 1 (Debian))
	id 1CzdxE-0003si-00; Fri, 11 Feb 2005 10:47:40 -0600
X-Mail-Format-Warning: Bad RFC2822 header formatting in >From joey  Fri Feb 11 10:47:37 2005
Received: from ns0.nexlab.net (nexlab.it) [213.198.155.21] 
	by master.debian.org with smtp (Exim 3.35 1 (Debian))
	id 1CzdxA-0003rs-00; Fri, 11 Feb 2005 10:47:36 -0600
Received: (qmail 25975 invoked by uid 1219); 11 Feb 2005 16:47:35 -0000
Received: from 80.116.153.178 by danex (envelope-from <godog@esaurito.net>, uid 1040) with qmail-scanner-1.24 
 (f-prot: 4.1.1/3.13.3. ,X-Envelope-From: godog@esaurito.net
Date: Fri, 11 Feb 2005 17:47:30 +0100
From: Filippo Giunchedi <filippo@esaurito.net>
To: dwn@debian.org
Subject: Re: RSS feed for DWN
Message-ID: <20050211164730.GA863@hattori.local>
References: <20050210165535.GA2005@hattori.local> <20050210172101.GJ1666@finlandia.infodrom.north.de>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="uh9ZiVrAOUUm9fzH"
Content-Disposition: inline
In-Reply-To: <20050210172101.GJ1666@finlandia.infodrom.north.de>
X-Editor: VIM - Vi IMproved 6.3
Organization: NoName Inc.
Delivered-To: dwn@debian.org
Delivered-To: joey@master.debian.org
X-Loop: debian-dwn@lists.debian.org
Sender: Martin Schulze <joey@master.debian.org>
X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on 
	luonnotar.infodrom.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,
	FORGED_RCVD_HELO autolearn=ham version=3.0.2
X-Folder: debian-dwn@lists.debian.org


--uh9ZiVrAOUUm9fzH
Content-Type: multipart/mixed; boundary="WhfpMioaduB5tiZL"
Content-Disposition: inline


--WhfpMioaduB5tiZL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Feb 10, 2005 at 06:21:02PM +0100, Martin Schulze wrote:
> Filippo Giunchedi wrote:
> > Hi Joey,
> > first of all thanks for DWN, it is very useful to have a weekly digest =
of
> > activity in debian!
> > I didn't find an RSS feed for DWN, is there one? If no I can provide on=
e by
> > either patching webwml or with an external link.
>=20
> Please go ahead, but and submit a patch for webwml.  However, the
> editorial should not be used as text.  The summary may, or the
> paragraph headlines.

Actually I used only the text within <strong></strong>, anyway it would be =
fine
to have also a named anchor with every news so you can directly refer to as

$(HOME)/News/weekly/<year>/<issue>/#title

by using for example a function weeklytitle(title) in
wml::debian::weeklynews::index

sub weeklytitle() {
    my ($title) =3D @_;
    $anchor =3D $title;
    $anchor =3D~ s/\s//g;
    $anchor =3D~ s/\.$//;
    print "<a name=3D\"$anchor\"></a><strong>$title</strong>";
}

I also made PUBDATE available as a comment for later retrieval, patch attac=
hed.

filippo
--
Filippo Giunchedi=20
GNU/PG key: 6B79D401
Random signature follows:

I find television very educating. Every time somebody turns on the set, I go
into the other room and read a book.
-- Groucho Marx

--WhfpMioaduB5tiZL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="dwn_fg.diff"
Content-Transfer-Encoding: quoted-printable

diff -urN -x *CVS* webwml.orig/english/News/weekly/makerss.pl webwml/englis=
h/News/weekly/makerss.pl
--- webwml.orig/english/News/weekly/makerss.pl	Thu Jan  1 01:00:00 1970
+++ webwml/english/News/weekly/makerss.pl	Fri Feb 11 17:22:30 2005
@@ -0,0 +1,91 @@
+#!/usr/bin/perl
+# Generates RSS feed for DWN, some code stolen from makemail.pl
+
+use locale;
+use POSIX qw(strftime);
+
+
+# default, if parsing the page can't find any
+$pubdate_rfc =3D strftime("%a, %d %b %Y %H:%M:%S %Z", gmtime());
+$pubdate =3D strftime("%Y-%m-%d", gmtime());
+
+# default language
+$lang =3D "en-us";
+
+my $current_issue=3D`cat CURRENT-ISSUE-IS`;
+chomp $current_issue;
+
+my $url=3Dshift || "http://www.debian.org/News/weekly/$current_issue/";;
+
+my $tmpfile;
+my $tmpdir;
+
+# Remove the multibyte stuff
+if ($url =3D~ "^http://";) {
+    open(IN, "wget -q -O - $url|") or die "Can't open $url: $!\n";
+
+    $tmpdir =3D "/tmp/dwn.$$";
+    mkdir $tmpdir || die "Can't mkdir, $!\n";
+    $tmpfile =3D "$tmpdir/dwn.html";
+} else {
+    open(IN, $url) or die "Can't open $url: $!\n";
+
+    my @foo =3D split (/\./, $url);
+    pop @foo;
+    $tmpfile =3D join (".", @foo) .".tmp.html";
+}
+
+open(OUT, ">$tmpfile") or die "Can't write to $tmpfile: $!\n";
+
+while (<IN>) {$all .=3D $_}
+
+# Remove old multibyte codes=20
+$all =3D~	s/\((&#\d{3,5};\s*)+\)//sg;
+
+print OUT $all;
+close (IN);
+close (OUT);
+
+my @stories;
+open (IN, $tmpfile) or die "Can't open $tmpfile";
+
+while (<IN>) {
+	# this fails with localized DWN
+    last if /<p><strong>Want to continue reading DWN/;
+
+    if( /<!-- (\d\d)-(\d\d)-(\d\d) -->/) {
+        # RFC-822 date
+        $pubdate_rfc =3D strftime("%a, %d %b %Y %H:%M:%S %Z", 0, 0, 0, $3,=
 $2, $1);
+        $pubdate =3D strftime("%Y-%m-%d", 0, 0, 0, $3, $2, $1);
+    }
+
+    # TODO have a named anchor in every <p> in index.wml so we can have a
+    # direct URL
+    if( /<p><strong>(.+)<\/strong>/) {
+       push @stories, $1;=20
+    }
+}
+
+print '
+<?xml version=3D"1.0" encoding=3D"ISO-8859-1"?>
+<rss version=3D"2.0" xmlns:dc=3D"http://purl.org/dc/elements/1.1/";>
+    <channel>
+        <title>Debian Weekly News</title>
+        <link>http://www.debian.org/News/weekly/</link>
+        <language>'.$lang.'</language>
+    </channel>
+';
+
+foreach $story (@stories){
+print "    <item>
+        <title>$story</title>
+        <link>http://www.debian.org/News/weekly/$current_issue/</link>
+        <dc:creator>dwn\@debian.org</dc:creator>
+        <dc:date>$pubdate</dc:date>
+    </item>
+";
+}
+print "</rss>\n";
+
+unlink ($tmpfile);
+rmdir ($tmpdir) if ($tmpdir);
diff -urN -x *CVS* webwml.orig/english/template/debian/weeklynews/header.wm=
l webwml/english/template/debian/weeklynews/header.wml
--- webwml.orig/english/template/debian/weeklynews/header.wml	Fri Feb 11 17=
:39:16 2005
+++ webwml/english/template/debian/weeklynews/header.wml	Thu Feb 10 20:51:0=
0 2005
@@ -3,3 +3,4 @@
 #use wml::debian::ctime
 #use wml::debian::links.tags
 #use wml::debian::template title=3D"<debianweeklynews/> - <:=3D&spokendate=
('$(PUBDATE)'):>$(PAGENAME)" NOHOMELINK=3D"yes" BARETITLE=3D"yes" NOCOMMENT=
S=3D"yes" SUMMARY=3D"$(SUMMARY)"
+<!-- $(PUBDATE) -->

--WhfpMioaduB5tiZL--

--uh9ZiVrAOUUm9fzH
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Darwin)

iD8DBQFCDOGiABzeamt51AERAqZcAJ0dV1y8hHHy1bPpvGtHeIYDbxY99ACgwqyX
mQIiSwqk6noVkql6vINVzeM=
=xY0H
-----END PGP SIGNATURE-----

--uh9ZiVrAOUUm9fzH--


--4N42/ivucor2EeDs--


Attachment: signature.asc
Description: Digital signature


Reply to: