Anonymous avatar Anonymous committed e96f4d8

Adapted the code to generate one year at a time (and that's it).

Comments (0)

Files changed (1)

wml/lib/render_lectures.pl

         };
 }
 
+@files = 
+(
+    map {
+        +{
+            'id' => $_,
+            'url' => "$_.html",
+            't_match' => ".*",
+            'no_header' => 1,
+            'year' => $_,
+        },
+    } (2003 .. 2005)
+);
+
 my ($grouped_file_idx) = (grep { $files[$_]->{'id'} eq "grouped" } (0 .. $#files));
 
 foreach my $f (@files)
         my $pattern = $file->{'t_match'};
         if ((grep { ($_ eq "all") || ($_ =~ m/^$pattern$/) } @$topics) &&
             (! ($is_header && $file->{'no_header'})) &&
-            (! ($is_past && $file->{'future_only'}))
+            (! ($is_past && $file->{'future_only'})) &&
+            (exists($file->{'year'}) ? ($file->{'year'} == $spec->{'year'}) : 1)
            )
         {
             $file->{'buffer'} .= join("", (map { (ref($_) eq "CODE" ? $_->($file) : $_) } @_));
     # Generate the date field
     
     my $date = $lecture->{'d'};
+    my ($date_day, $date_month, $date_year) = split(m!/!, $date);
 
     if (! $is_future )
     {
-        my ($date_day, $date_month, $date_year) = split(m!/!, $date);
-
-        my $cmp_val = 
-            (($date_year <=> $this_year) || 
+        my $cmp_val =
+            (($date_year <=> $this_year) ||
             ($date_month <=> $this_month) ||
             ($date_day <=> $this_day));
 
         { 
             'topics' => $lecture->{'t'},
             'past' => (! $is_future),
+            'year' => $date_year,
         },
         $rendered_lecture
     );
 }
 continue
 {
-    my $series = $lecture->{'series'};
-    my $lecture_idx = ($series_indexes{$series}++);
-    if (($series eq 'default') && ($lecture_idx == $last_idx_in_group))
+    if (defined($grouped_file_idx))
     {
-        $group_id++;
-        my $f = $files[$grouped_file_idx];
-        my $buffer = $f->{'buffer'};
-        $buffer .= $page_footer;
-        open O, ">$dest_dir/$f->{'url'}";
-        print O $buffer;
-        close(O);
-        $f = $files[$grouped_file_idx] = $get_grouped_file->();
-        $f->{'buffer'} .= join("", $get_header->($f));
-        $f->{'buffer'} .= $table_headers;
+        my $series = $lecture->{'series'};
+        my $lecture_idx = ($series_indexes{$series}++);
+        if (($series eq 'default') && ($lecture_idx == $last_idx_in_group))
+        {
+            $group_id++;
+            my $f = $files[$grouped_file_idx];
+            my $buffer = $f->{'buffer'};
+            $buffer .= $page_footer;
+            open O, ">$dest_dir/$f->{'url'}";
+            print O $buffer;
+            close(O);
+            $f = $files[$grouped_file_idx] = $get_grouped_file->();
+            $f->{'buffer'} .= join("", $get_header->($f));
+            $f->{'buffer'} .= $table_headers;
+        }
     }
 }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.