#!/usr/bin/perl # # $Header: /cvsroot/arsperl/ARSperl/infra/mkchanges.pl,v 1.8 2007/03/13 13:20:33 jeffmurphy Exp $ # # mkchanges.pl [-t] -f changes.dat # # generate a "CHANGES" or "changes.html" file # based on the "changes.dat" file # # jeff murphy # jcmurphy@hot-sauce.org # # this code is available under the terms of the GNU license or the # Perl Artistic License (your choice). use strict; use FileHandle; use vars qw{$opt_t $opt_f}; require 'getopts.pl'; Getopts('tf:'); my ($html) = defined($opt_t)?0:1; if((!defined($opt_f)) || (! -e "$opt_f")) { die "usage: mkchanges.pl [-t] -f changes.dat > outputfile -t text output (default = html) -f changes.dat input file "; } my($f) = new FileHandle($opt_f, "r"); die "open($opt_f) failed: $!" if !defined($f); if($html) { headerHTML(); } else { headerTXT(); } while(<$f>) { next if /^\#/; if(/^released=(\S+)\s+version=(.*)/) { if($html) { spewHTML($f, $1, $2); } else { spewTXT($f, $1, $2); } } } $f->close(); if($html) { footerHTML(); } else { footerTXT(); } exit 0; sub spewHTML { my ($f, $rel, $ver) = (shift, shift, shift); my ($first) = 1; my ($beenthere) = 0; my ($count) = 0; while(<$f>) { chomp; if(/^$/) { print "\n\n

\n\n"; return; } if(/^(\S+)/) { my $who = $1; my $cc = ' '; s/^$who//; if($who =~ /^\!/) { $cc = '!'; $who =~ s/^\!//; } s/^\s+//g; if($first) { $first = 0; print "
"; } if($beenthere) { print "\n"; } $count++; my ($bgc) = "\#dddddd"; $bgc = "\#eeeeee" if($count % 2); print "
Released: $rel Version: $ver
($who)"; $beenthere = 1; if($cc eq "!") { print ""; } else { print ""; } print "$_ \n"; } else { s/^\s+//g; print "$_ "; } } } sub spewTXT { my ($f, $rel, $ver) = (shift, shift, shift); my ($bq) = 0; print "Released: $rel Version: $ver\n\n"; while(<$f>) { chomp; s/<[\/]{0,1}U>/_/gi; $bq = 1 if(/\/i); $bq = 0 if(/\<\/BLOCKQUOTE>/i); s/<[\/]{0,1}BLOCKQUOTE>/\ /gi; s/<[\/]{0,1}BR>/\ /gi; s/>/>/g; s/</ ARSperl: Revision History \n"; print "

Changes for ARSperl

BM=Bill Middleton {wjm at metronet.com}
GDF=G. David Frye {gdf at uiuc.edu}
JCM=Jeff Murphy {jeffmurphy at sourceforge.net}
JWM=Joel Murphy {jmurphy at buffalo.edu}
TS=Thilo Stapff {tstapff at sourceforge.net}

The following lists the changes that have been made for each release of ARSperl.

Items in red denote changes that are incompatible with previous versions of ARSperl and may require altering of some ARSperl scripts.

"; } sub footerHTML { print "\n

\n

\$Header\$
\n"; } sub headerTXT { print "CHANGES for ARSperl Revision history for ARSperl. BM = Bill Middleton GDF = G. David Frye JCM = Jeff Murphy JWM = Joel Murphy Note: items preceeded by a '!' denoted changes that are incompatible with previous versions of arsperl and may require altering of some arsperl scripts.\n\n "; } sub footerTXT { print "\n\narsperl\@arsperl.org\n\n\$Header\$\n\n"; }