Permalink
Browse files

fix the links (and formating) for the feed

  • Loading branch information...
1 parent ad19550 commit 6b85b9882640f5957f21c093f9549361450e94b7 @yanick committed Nov 14, 2010
Showing with 16 additions and 1 deletion.
  1. +1 −0 lib/Galuga/Controller/Entry.pm
  2. +15 −1 lib/Galuga/Controller/Root.pm
@@ -87,6 +87,7 @@ sub code_snippet {
my $content = slurp( join '/', $c->config->{blog_root}, $entry->path,
'files', $1 );
+ $content =~ s/&/&/g;
$content =~ s/</&lt;/g;
$content =~ s/>/&gt;/g;
@@ -98,12 +98,26 @@ sub feed :Path('atom.xml') :Args(0) {
);
for ( @entries ) {
+
+ my $body = $_->body;
+
+ # __ENTRY_DIR__
+ $body =~ s#__ENTRY_DIR__# $c->uri_for( "/entry/" . $_->url . "/files" ) #eg;
+
+ $body =~
+ s#(<galuga_code.*?</galuga_code>)#Galuga::Controller::Entry::code_snippet( $c, $_, $1 )#eg;
+
+ $body =~ s#<pre \s+ code=(['"])(.*?)\1#<pre class="brush: $2" #xg;
+
+ $body =~ s#<cpan>(.*?)</cpan>#Galuga::Controller::Entry::cpan_tag($1)#eg;
+ $body =~ s#<galuga_entry>(.*?)</galuga_entry>#Galuga::Controller::Entry::entry_tag( $c, $1)#eg;
+
$feed->add_entry(
title => $_->title,
link => $c->uri_for( '/entry', $_->url ),
content => {
type => 'xhtml',
- content => $_->body,
+ content => $body,
},
updated => $_->created->iso8601,
);

0 comments on commit 6b85b98

Please sign in to comment.