subtitle handling, prettified dates. bugfixes and better errors
[scpubgit/SCS.git] / lib / SCSite / SubListFilter.pm
index 4246bd6..53489f3 100644 (file)
@@ -7,13 +7,17 @@ with 'SCSite::Filter';
 sub _filter_stream {
   my ($self, $stream, $config, $page) = @_;
   my $max = $config->{max_entries}||undef; # explicit undef (not 0)
+  my %child =
+    map +(exists $config->{$_} ? ($_ => $config->{$_}) : ()),
+      qw(min_depth max_depth at_depth);
   $stream->select('.SubList')
-         ->repeat_content($page->children->latest($max)->map(sub {
+         ->repeat_content($page->children(%child)->latest($max)->map(sub {
              my $o = shift;
              sub {
                $_->select('.entry.title')->replace_content($o->title)
+                 ->select('.entry.subtitle')->replace_content($o->subtitle)
                  ->select('.entry.description')->replace_content($o->description)
-                 ->select('.entry.created')->replace_content($o->created)
+                 ->select('.entry.published_at')->replace_content($o->published_at)
                  ->select('.entry.link')->set_attribute(href => $o->path);
              }
           }));