@@ -3394,6 +3394,51 @@ sub get_page_title {
3394
3394
return $title ;
3395
3395
}
3396
3396
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
+
3397
3442
sub git_header_html {
3398
3443
my $status = shift || " 200 OK" ;
3399
3444
my $expires = shift ;
@@ -3443,48 +3488,8 @@ sub git_header_html {
3443
3488
print ' <link rel="stylesheet" type="text/css" href="' .esc_url($stylesheet ).' "/>' ." \n " ;
3444
3489
}
3445
3490
}
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' );
3488
3493
if (defined $favicon ) {
3489
3494
print qq( <link rel="shortcut icon" href=") .esc_url($favicon ).qq( " type="image/png" />\n ) ;
3490
3495
}
0 commit comments