[Mailman-Users] my kludge for reverse sorting mailman's pipermail "sort by date" page

A.N.Varady spaceling at iname.com
Wed Jan 31 18:15:20 CET 2001


Hi,

I'm just learning PERL and am using mailman with pipermail. I wanted to add a
pipermail generated archive page to my website. So I wrote a little code to turn
the html of the "date" sorted page upside down. And I used an SSI and some PHP
to add the reverse sorted page to my website. I'm a total novice so this will
probably look highly inelegant to more experienced hackers.

Maybe my example will be of interest or use to someone, or maybe someone has
some comments or improvements for me.

First, the link to where this is all happening: http://simpletone.com/pacman/

In this example, I have a page called news.shtml, and a php script called
import.php (I need the shtml to tell the web server I'm using Server Side
Includes in my page). 

        In my news.shtml I add:
               
   <!--#include file="import.php"--> 

        import.php looks like this:

   <?php include ('http://phobos.serve.com/radio/read.html'); ?>


read.html is the page printed by my reverse sorting PERL script. 
The script looks like this:
---------------------------------------
#!/usr/bin/perl

$infile =
"/home/mailman/archives/private/philly_ambient/2001-January/date.html";
open (IN, $infile);
$text = '';

while ($line = <IN>) {
    chomp ($line);
    $text = $text . $line;
}

my (@lines);

$text =~ s/\<LI/\nqqqq\<LI/g;

@lines = ();
@lines = split (/qqqq/, $text);

@newlines = reverse(@lines);

$out = "/www/html/radio/read.html";
open (OUT, ">$out");

foreach $l (@newlines) {
    print OUT $l;
    print $l;
}
close(OUT);  
--------------------------------------------------------

To get all of this smoothly working for my site I've set this script to run in
crontab. I also have another script to find and replace certain strings in
read.html that make the page look bad or cause problems). I don't recommend
using this script on the pipermail generated thread page. There are two many
<ul> and <li> tags which make the reversed page look bad.

I don't know python, so I don't think I can fix pipermail's sorting problem.
Hopefully someone is working on it. I've also had problems with pipermail
failing to resolve an author name from email sent from AOL email addresses.
Mhonarc doesn't have this bug, but it has other annoying ones for me, so i have
to use pipermail for archiving now. 

If you try to use this script you migh

Aharon




More information about the Mailman-Users mailing list