-sub footer {
- my ($ctx) = @_;
- return '' unless $ctx;
- my $git_dir = ctx_get($ctx, 'git_dir');
-
- # favor user-supplied footer
- my $footer = try_cat("$git_dir/public-inbox/footer.html");
- if (defined $footer) {
- chomp $footer;
- $ctx->{footer} = $footer;
- return $footer;
- }
-
- # auto-generate a footer
- my $listname = ctx_get($ctx, 'listname');
- my $desc = try_cat("$git_dir/description");
- $desc = '$GIT_DIR/description missing' unless defined $desc;
- chomp $desc;
-
- my $urls = try_cat("$git_dir/cloneurl");
- my @urls = split(/\r?\n/, $urls || '');
- my $nurls = scalar @urls;
- if ($nurls == 0) {
- $urls = '($GIT_DIR/cloneurl missing)';
- } elsif ($nurls == 1) {
- $urls = "git URL for <a\nhref=\"" . SSOMA_URL .
- '">ssoma</a>: ' . $urls[0];
- } else {
- $urls = "git URLs for <a\nhref=\"" . SSOMA_URL .
- "\">ssoma</a>:\n" . join("\n", map { "\t$_" } @urls);
- }
-
- my $addr = $pi_config->get($listname, 'address');
- if (ref($addr) eq 'ARRAY') {
- $addr = $addr->[0]; # first address is primary
- }
-
- $addr = "<a\nhref=\"mailto:$addr\">$addr</a>";
-
- $ctx->{footer} = join("\n",
- '- ' . $desc,
- "A <a\nhref=\"" . PI_URL . '">public-inbox</a>, ' .
- 'anybody may post in plain-text (not HTML):',
- $addr,
- $urls
- );
-}
-