@@ -3394,6 +3394,51 @@ sub get_page_title {
33943394 return $title ;
33953395}
33963396
3397+ sub print_feed_meta {
3398+ if (defined $project ) {
3399+ my %href_params = get_feed_info();
3400+ if (!exists $href_params {' -title' }) {
3401+ $href_params {' -title' } = ' log' ;
3402+ }
3403+
3404+ foreach my $format qw( RSS Atom) {
3405+ my $type = lc ($format );
3406+ my %link_attr = (
3407+ ' -rel' => ' alternate' ,
3408+ ' -title' => esc_attr(" $project - $href_params {'-title'} - $format feed" ),
3409+ ' -type' => " application/$type +xml"
3410+ );
3411+
3412+ $href_params {' action' } = $type ;
3413+ $link_attr {' -href' } = href(%href_params );
3414+ print " <link " .
3415+ " rel=\" $link_attr {'-rel'}\" " .
3416+ " title=\" $link_attr {'-title'}\" " .
3417+ " href=\" $link_attr {'-href'}\" " .
3418+ " type=\" $link_attr {'-type'}\" " .
3419+ " />\n " ;
3420+
3421+ $href_params {' extra_options' } = ' --no-merges' ;
3422+ $link_attr {' -href' } = href(%href_params );
3423+ $link_attr {' -title' } .= ' (no merges)' ;
3424+ print " <link " .
3425+ " rel=\" $link_attr {'-rel'}\" " .
3426+ " title=\" $link_attr {'-title'}\" " .
3427+ " href=\" $link_attr {'-href'}\" " .
3428+ " type=\" $link_attr {'-type'}\" " .
3429+ " />\n " ;
3430+ }
3431+
3432+ } else {
3433+ printf (' <link rel="alternate" title="%s projects list" ' .
3434+ ' href="%s" type="text/plain; charset=utf-8" />' ." \n " ,
3435+ esc_attr($site_name ), href(project => undef , action => " project_index" ));
3436+ printf (' <link rel="alternate" title="%s projects feeds" ' .
3437+ ' href="%s" type="text/x-opml" />' ." \n " ,
3438+ esc_attr($site_name ), href(project => undef , action => " opml" ));
3439+ }
3440+ }
3441+
33973442sub git_header_html {
33983443 my $status = shift || " 200 OK" ;
33993444 my $expires = shift ;
@@ -3443,48 +3488,8 @@ sub git_header_html {
34433488 print ' <link rel="stylesheet" type="text/css" href="' .esc_url($stylesheet ).' "/>' ." \n " ;
34443489 }
34453490 }
3446- if (defined $project ) {
3447- my %href_params = get_feed_info();
3448- if (!exists $href_params {' -title' }) {
3449- $href_params {' -title' } = ' log' ;
3450- }
3451-
3452- foreach my $format qw( RSS Atom) {
3453- my $type = lc ($format );
3454- my %link_attr = (
3455- ' -rel' => ' alternate' ,
3456- ' -title' => esc_attr(" $project - $href_params {'-title'} - $format feed" ),
3457- ' -type' => " application/$type +xml"
3458- );
3459-
3460- $href_params {' action' } = $type ;
3461- $link_attr {' -href' } = href(%href_params );
3462- print " <link " .
3463- " rel=\" $link_attr {'-rel'}\" " .
3464- " title=\" $link_attr {'-title'}\" " .
3465- " href=\" $link_attr {'-href'}\" " .
3466- " type=\" $link_attr {'-type'}\" " .
3467- " />\n " ;
3468-
3469- $href_params {' extra_options' } = ' --no-merges' ;
3470- $link_attr {' -href' } = href(%href_params );
3471- $link_attr {' -title' } .= ' (no merges)' ;
3472- print " <link " .
3473- " rel=\" $link_attr {'-rel'}\" " .
3474- " title=\" $link_attr {'-title'}\" " .
3475- " href=\" $link_attr {'-href'}\" " .
3476- " type=\" $link_attr {'-type'}\" " .
3477- " />\n " ;
3478- }
3479-
3480- } else {
3481- printf (' <link rel="alternate" title="%s projects list" ' .
3482- ' href="%s" type="text/plain; charset=utf-8" />' ." \n " ,
3483- esc_attr($site_name ), href(project => undef , action => " project_index" ));
3484- printf (' <link rel="alternate" title="%s projects feeds" ' .
3485- ' href="%s" type="text/x-opml" />' ." \n " ,
3486- esc_attr($site_name ), href(project => undef , action => " opml" ));
3487- }
3491+ print_feed_meta()
3492+ if ($status eq ' 200 OK' );
34883493 if (defined $favicon ) {
34893494 print qq( <link rel="shortcut icon" href=") .esc_url($favicon ).qq( " type="image/png" />\n ) ;
34903495 }
0 commit comments