]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* Make the aggregate plugin emphasize error messages.
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 13 Oct 2006 18:31:18 +0000 (18:31 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 13 Oct 2006 18:31:18 +0000 (18:31 +0000)
IkiWiki/Plugin/aggregate.pm
debian/changelog

index ac55dcb1daa5ec5daf959929e97bd6d614625819..2e1ab66e644775faad5b0bcbc231bb5fbd1e0e95 100644 (file)
@@ -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
index 7ca09b368fce78965596404610e81566736a4645..75c49880fd365d9a01478ce02d54beb578216598 100644 (file)
@@ -21,8 +21,9 @@ ikiwiki (1.29) UNRELEASED; urgency=low
     of feeds.
   * $IkiWiki::version now holds the program version, and is accessible to
     plugins.
+  * Make the aggregate plugin emphasize error messages.
 
- -- Joey Hess <joeyh@debian.org>  Sun,  8 Oct 2006 18:36:30 -0400
+ -- Joey Hess <joeyh@debian.org>  Fri, 13 Oct 2006 14:19:28 -0400
 
 ikiwiki (1.28) unstable; urgency=low