Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 96 lines (72 sloc) 1.543 kb
#!/usr/bin/perl
use strict;
use warnings;
use 5.010;
use Template;
use Data::Dumper;
my $t = Template->new;
my $years = [ 1988 .. 2012 ];
my $x_offset = sub {
my $year = shift;
my $x_offset = ($year - 1988) % 5;
$x_offset *= 960 * 3;
return $x_offset;
};
my $y_offset = sub {
my $year = shift;
my $y_offset = int(($year - 1988) / 5);
$y_offset *= 760 * 3;
return $y_offset;
};
$t->process('index.tt', {
releases => get_rel(),
headlines => get_headlines(),
tech => get_tech(),
community => get_community(),
books => get_books(),
years => $years,
get_x_offset => $x_offset,
get_y_offset => $y_offset,
disp_year => \&disp_year,
}, 'index.html')
or die $t->error;
sub get_list {
my ($file) = @_;
my $list = {};
if (-f $file) {
open my $fh, '<', $file or die $!;
while (<$fh>) {
next unless /\S/;
chomp;
my ($year, $data) = split /\s+/, $_, 2;
push @{$list->{$year}}, $data;
}
} else {
warn "File: $file not found";
}
$list->{1988} = [ @{$list->{1987} || []}, @{$list->{1988} || []} ];
delete $list->{1987};
return $list;
}
sub get_rel {
return get_list('releases.txt');
}
sub get_headlines {
my $hl = get_list('headlines.txt');
foreach (keys %$hl) {
$hl->{$_} = $hl->{$_}[0];
}
return $hl;
}
sub get_tech {
return get_list('tech.txt');
}
sub get_community {
return get_list('community.txt');
}
sub get_books {
return get_list('books.txt');
}
sub disp_year {
return $_[0] == 1988 ? '1987/8' : $_[0];
}
Jump to Line
Something went wrong with that request. Please try again.