#!/usr/bin/perl -w
use diagnostics;
use strict;

my $mainindex = "mainindex.def.nl.txt";

if (!-e "$mainindex") {
    print "Error: $mainindex does not exsist!$/";
    exit(0);
}

my $month = "";
my $month_nl = "";

print "<H2>Op Komst</h2><br>$/";
print "Op het moment werken we aan de vertaling van deze artikels:<br>$/";
print "<UL>$/";
open (FILE, "$mainindex");
while (my $line = <FILE>) {
    if ($line =~ m/^month\:\s?(.*?)\s*?\+\+\s?(.*)/) {
	$month = $1;
        $month_nl = $2;
    } elsif ($line =~ m/^(\s|\d)*\+\+/) {
	my @info = split('\+\+', $line);
        #print "$_";
        if (scalar(@info) < 6 ) {
	    print "Error: to little arguments in in $mainindex file: $line";
	    # skip this line
        } else {
	    my $id = $info[0];
          my $finished = $info[1];
          my $title = $info[2];
	    my $translator = $info[3];
          if (!($finished =~ "x") && ($translator =~ /\w/)) {
            print "  <LI>$title (<a href=\"$month\">$month_nl</a>)<br><br>$/";
          }
        }
    }
}
close(FILE);
print "</UL>$/";
