]> rtime.felk.cvut.cz Git - edu/osp-wiki.git/commitdiff
Script to generate projects list/directory page updated for English pages version.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Sat, 18 May 2013 18:17:55 +0000 (20:17 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Sat, 18 May 2013 18:17:55 +0000 (20:17 +0200)
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
student/projects.pl

index bc4ff582fae7dabd8bd9d8065d8ec3463027b740..81c988b0cd668aaae8b4ee28018f25305919fa4b 100755 (executable)
@@ -5,7 +5,7 @@ use Data::Dumper;
 my %projects;
 
 
-foreach my $year (qw/2010 2011 2012/) {
+foreach my $year (qw/2010 2011 2012 2013/) {
     open LIST, "projects$year";
     while (<LIST>) {
        chomp;
@@ -13,8 +13,14 @@ foreach my $year (qw/2010 2011 2012/) {
        my ($project, $url, $name);
        open PAGE, $file;
        while (<PAGE>) {
+           if (/Project name and homepage[:* ]*\[([^\[\]]*)\]\(([^()]*)\)/) {
+               $project = $1;
+               $url = $2;
+           }
            if (/(Název projektu|Project name)[:* ]*(.*)/) {
-               $project = $2;
+               if (!$project) {
+                   $project = $2;
+               }
            }
            if (/(Domovská stránka projektu|Project home ?page)[:* ]*<(.*)>/) {
                $url = $2;
@@ -24,6 +30,10 @@ foreach my $year (qw/2010 2011 2012/) {
            }
        }
 
+       if (!$project or !$name or !$url) {
+           print STDERR "Expected field missing in $file\n";
+        }
+
        print STDERR "Working on student $name ($year)\n";
        if (!$projects{$project}) {
            $projects{$project} = {};
@@ -37,6 +47,9 @@ foreach my $year (qw/2010 2011 2012/) {
 
 print '[[!meta title="Projekty"]]'."\n";
 print '[[!meta stylesheet="/columns" rel="stylesheet"]]'."\n";
+print "\n";
+print 'This page lists the projects and which students worked on them in the'."\n";
+print 'past years.'."\n";
 
 foreach (sort(keys(%projects))) {
     print "\n* [$_](", $projects{$_}{'url'}, ")\n";