@@ -10,7 +10,6 @@ use HTML::Escape qw( escape_html );
1010use MetaCPAN::Web::RenderUtil qw( render_markdown ) ;
1111use MetaCPAN::Web::Types qw( ArrayRef DateTime Enum HashRef Str Undef Uri ) ;
1212use Params::ValidationCompiler qw( validation_for ) ;
13- use Path::Tiny qw( path ) ;
1413use XML::FeedPP (); # # no perlimports
1514use URI ();
1615
@@ -59,60 +58,6 @@ sub recent : Private {
5958 );
6059}
6160
62- sub news_rss : Path(' /news.rss' ) Args(0) {
63- my ( $self , $c ) = @_ ;
64- $c -> detach( ' news' , [' rss' ] );
65- }
66-
67- sub news_atom : Path(' /news.atom' ) Args(0) {
68- my ( $self , $c ) = @_ ;
69- $c -> detach( ' news' , [' atom' ] );
70- }
71-
72- sub news : Private {
73- my ( $self , $c , $type ) = @_ ;
74-
75- $c -> add_surrogate_key(' NEWS' );
76- $c -> browser_max_age(' 1h' );
77- $c -> cdn_max_age(' 1h' );
78-
79- my $file = $c -> config-> {home } . ' /News.md' ;
80- my $news = path($file )-> slurp_utf8;
81- $news =~ s / ^\s +|\s +$// g ;
82- my @entries ;
83- foreach my $str ( split /^Title:\s */m , $news ) {
84- next if $str =~ /^\s *$ /;
85-
86- my %e ;
87- $e {name} = $str =~ s/\A (.+)$ //m ? $1 : 'No title';
88-
89- # Use the same processing as _Header2Label in
90- # Text::MultiMarkdown
91- my $a_name = lc $e {name};
92- $a_name =~ s/[^A-Za-z0-9:_.-] //g;
93- $a_name =~ s/^[^a-z] +//gi;
94-
95- $str =~ s/\A\s *-+//g;
96- $e {date} = $str =~ s/^Date:\s *(.*)$ //m ? $1 : '2014-01-01T00:00:00';
97- $e {link} = '/news';
98- $e {fragment} = $a_name ;
99- $e {author} = 'METACPAN';
100- $str =~ s/^\s *|\s *$ //g;
101-
102- #$str =~ s{\[ ([^]]+)\]\( ([^)]+)\) }{<a href="$2 ">$1 </a>}g;
103- $e {abstract} = $str ;
104- $e {abstract} = render_markdown($str );
105-
106- push @entries , \%e ;
107- }
108-
109- $c -> stash-> {feed } = $self -> build_feed(
110- format => $type ,
111- entries => \@entries ,
112- host => $c -> config-> {web_host },
113- title => ' Recent MetaCPAN News' ,
114- );
115- }
11661
11762sub author_rss : Chained(' /author/root' ) PathPart(' activity.rss' ) Args(0) {
11863 $_ [1]-> detach( ' author' , [' rss' ] );
0 commit comments