Show
Ignore:
Timestamp:
05/07/04 18:01:35 (5 years ago)
Author:
earle
Message:

require CGI::Wiki::Plugin::RSS::Reader 1.2, also simply RSS macro name

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/OpenGuides/Utils.pm

    r347 r348  
    113113                  return qq(<a href="$script_name?action=index;index_type=) . uri_escape(lc($_[0])) . qq(;index_value=) . uri_escape($_[1]) . qq(">$link_title</a>); 
    114114                }, 
    115         qr/\@RSS_FEED\s+\[(.*?)\]/ => sub {  
    116                                             # Get the URL. It's already been formatted into a  
    117                                             # hyperlink so we need to reverse that. 
    118                                             my $url_raw = $_[0]; 
    119                                             $url_raw =~ />(.*?)</; 
    120                                             my $url = $1; 
     115        qr/\@RSS\s+\[(.*?)\]/ => sub {  
     116                                      # Get the URL. It's already been formatted into a  
     117                                      # hyperlink so we need to reverse that. 
     118                                      my $url_raw = $_[0]; 
     119                                      $url_raw =~ />(.*?)</; 
     120                                      my $url = $1; 
    121121 
    122                                             # Retrieve the RSS from the given URL. 
    123                                             my $rss = CGI::Wiki::Plugin::RSS::Reader->new(url => $url); 
    124                                             my @items = $rss->retrieve; 
     122                                      # Retrieve the RSS from the given URL. 
     123                                      my $rss = CGI::Wiki::Plugin::RSS::Reader->new(url => $url); 
     124                                      my @items = $rss->retrieve; 
    125125 
    126                                             # Ten items only at this till. 
    127                                             $#items = 10 if $#items > 10; 
     126                                      # Ten items only at this till. 
     127                                      $#items = 10 if $#items > 10; 
    128128 
    129                                             # Make an HTML list with them. 
    130                                             my $list = "<ul>\n"; 
    131                                             foreach (@items) 
    132                                             { 
    133                                               $list .= qq{\t<li><a href="} . $_->{link} . qq{">} . $_->{title} . "</a></li>\n"; 
    134                                             } 
    135                                             $list .= "</ul>\n"; 
    136  
    137                                             return $list; 
    138                                           } 
     129                                      # Make an HTML list with them. 
     130                                      my $list = "<ul>\n"; 
     131                                      foreach (@items) 
     132                                      { 
     133                                        my $link  = $_->{link}; 
     134                                        my $title = $_->{title}; 
     135                                        $list .= qq{\t<li><a href="$link">$title</a></li>\n}; 
     136                                      } 
     137                                      $list .= "</ul>\n"; 
     138                                    } 
    139139    ); 
    140140