@@ -3479,6 +3479,51 @@ sub get_page_title {
34793479 return $title ;
34803480}
34813481
3482+ sub print_feed_meta {
3483+ if (defined $project ) {
3484+ my %href_params = get_feed_info();
3485+ if (!exists $href_params {' -title' }) {
3486+ $href_params {' -title' } = ' log' ;
3487+ }
3488+
3489+ foreach my $format qw( RSS Atom) {
3490+ my $type = lc ($format );
3491+ my %link_attr = (
3492+ ' -rel' => ' alternate' ,
3493+ ' -title' => esc_attr(" $project - $href_params {'-title'} - $format feed" ),
3494+ ' -type' => " application/$type +xml"
3495+ );
3496+
3497+ $href_params {' action' } = $type ;
3498+ $link_attr {' -href' } = href(%href_params );
3499+ print " <link " .
3500+ " rel=\" $link_attr {'-rel'}\" " .
3501+ " title=\" $link_attr {'-title'}\" " .
3502+ " href=\" $link_attr {'-href'}\" " .
3503+ " type=\" $link_attr {'-type'}\" " .
3504+ " />\n " ;
3505+
3506+ $href_params {' extra_options' } = ' --no-merges' ;
3507+ $link_attr {' -href' } = href(%href_params );
3508+ $link_attr {' -title' } .= ' (no merges)' ;
3509+ print " <link " .
3510+ " rel=\" $link_attr {'-rel'}\" " .
3511+ " title=\" $link_attr {'-title'}\" " .
3512+ " href=\" $link_attr {'-href'}\" " .
3513+ " type=\" $link_attr {'-type'}\" " .
3514+ " />\n " ;
3515+ }
3516+
3517+ } else {
3518+ printf (' <link rel="alternate" title="%s projects list" ' .
3519+ ' href="%s" type="text/plain; charset=utf-8" />' ." \n " ,
3520+ esc_attr($site_name ), href(project => undef , action => " project_index" ));
3521+ printf (' <link rel="alternate" title="%s projects feeds" ' .
3522+ ' href="%s" type="text/x-opml" />' ." \n " ,
3523+ esc_attr($site_name ), href(project => undef , action => " opml" ));
3524+ }
3525+ }
3526+
34823527sub git_header_html {
34833528 my $status = shift || " 200 OK" ;
34843529 my $expires = shift ;
@@ -3528,48 +3573,8 @@ sub git_header_html {
35283573 print ' <link rel="stylesheet" type="text/css" href="' .esc_url($stylesheet ).' "/>' ." \n " ;
35293574 }
35303575 }
3531- if (defined $project ) {
3532- my %href_params = get_feed_info();
3533- if (!exists $href_params {' -title' }) {
3534- $href_params {' -title' } = ' log' ;
3535- }
3536-
3537- foreach my $format qw( RSS Atom) {
3538- my $type = lc ($format );
3539- my %link_attr = (
3540- ' -rel' => ' alternate' ,
3541- ' -title' => esc_attr(" $project - $href_params {'-title'} - $format feed" ),
3542- ' -type' => " application/$type +xml"
3543- );
3544-
3545- $href_params {' action' } = $type ;
3546- $link_attr {' -href' } = href(%href_params );
3547- print " <link " .
3548- " rel=\" $link_attr {'-rel'}\" " .
3549- " title=\" $link_attr {'-title'}\" " .
3550- " href=\" $link_attr {'-href'}\" " .
3551- " type=\" $link_attr {'-type'}\" " .
3552- " />\n " ;
3553-
3554- $href_params {' extra_options' } = ' --no-merges' ;
3555- $link_attr {' -href' } = href(%href_params );
3556- $link_attr {' -title' } .= ' (no merges)' ;
3557- print " <link " .
3558- " rel=\" $link_attr {'-rel'}\" " .
3559- " title=\" $link_attr {'-title'}\" " .
3560- " href=\" $link_attr {'-href'}\" " .
3561- " type=\" $link_attr {'-type'}\" " .
3562- " />\n " ;
3563- }
3564-
3565- } else {
3566- printf (' <link rel="alternate" title="%s projects list" ' .
3567- ' href="%s" type="text/plain; charset=utf-8" />' ." \n " ,
3568- esc_attr($site_name ), href(project => undef , action => " project_index" ));
3569- printf (' <link rel="alternate" title="%s projects feeds" ' .
3570- ' href="%s" type="text/x-opml" />' ." \n " ,
3571- esc_attr($site_name ), href(project => undef , action => " opml" ));
3572- }
3576+ print_feed_meta()
3577+ if ($status eq ' 200 OK' );
35733578 if (defined $favicon ) {
35743579 print qq( <link rel="shortcut icon" href=") .esc_url($favicon ).qq( " type="image/png" />\n ) ;
35753580 }
0 commit comments