diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-10-13 18:31:18 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-10-13 18:31:18 +0000 |
commit | 92563604909d8de1b56e756274fd04c04d45cf67 (patch) | |
tree | a78876c18b5f5f2bbfc217903b9db393a2dfc086 /IkiWiki | |
parent | 8f4878d8aee676157d9d24e926dbd80d440b581a (diff) |
* Make the aggregate plugin emphasize error messages.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/aggregate.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index ac55dcb1d..2e1ab66e6 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -83,6 +83,7 @@ sub preprocess (@) { #{{{ $feed->{numposts}=0 unless defined $feed->{numposts}; $feed->{newposts}=0 unless defined $feed->{newposts}; $feed->{message}="new feed" unless defined $feed->{message}; + $feed->{error}=0 unless defined $feed->{error}; $feed->{tags}=[]; while (@_) { my $key=shift; @@ -93,7 +94,9 @@ sub preprocess (@) { #{{{ } return "<a href=\"".$feed->{url}."\">".$feed->{name}."</a>: ". - "<i>".$feed->{message}."</i> (".$feed->{numposts}." posts". + ($feed->{error} ? "<em>" : "").$feed->{message}. + ($feed->{error} ? "</em>" : ""). + " (".$feed->{numposts}." posts". ($feed->{newposts} ? "; ".$feed->{newposts}." new" : ""). ")"; } # }}} @@ -199,6 +202,7 @@ sub aggregate () { #{{{ my @urls=XML::Feed->find_feeds($feed->{url}); if (! @urls) { $feed->{message}="could not find feed at ".$feed->{feedurl}; + $feed->{error}=1; debug($feed->{message}); next; } @@ -207,11 +211,13 @@ sub aggregate () { #{{{ my $f=eval{XML::Feed->parse(URI->new($feed->{feedurl}))}; if ($@) { $feed->{message}="feed crashed XML::Feed! $@"; + $feed->{error}=1; debug($feed->{message}); next; } if (! $f) { $feed->{message}=XML::Feed->errstr; + $feed->{error}=1; debug($feed->{message}); next; } @@ -229,6 +235,7 @@ sub aggregate () { #{{{ $feed->{message}="processed ok at ". displaytime($feed->{lastupdate}); + $feed->{error}=0; } # TODO: expiry |