Changeset 348
- Timestamp:
- 05/07/04 18:01:35 (5 years ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
Build.PL (modified) (1 diff)
-
Changes (modified) (1 diff)
-
PREREQUISITES (modified) (1 diff)
-
lib/OpenGuides/Utils.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Build.PL
r347 r348 226 226 'CGI::Wiki::Plugin::Locator::UK' => '0.06', 227 227 'CGI::Wiki::Plugin::RSS::ModWiki' => '0.02', 228 'CGI::Wiki::Plugin::RSS::Reader' => 0,228 'CGI::Wiki::Plugin::RSS::Reader' => '1.2', # earlier versions don't support RSS 2.0 229 229 'Config::Tiny' => 0, 230 230 'Data::Dumper' => 0, -
trunk/Changes
r347 r348 3 3 pages, using CGI::Wiki::Plugin::RSS::Reader. This allows you 4 4 to do this to produce a list of up to ten hyperlinks: 5 @RSS _FEED[http://example.com/example.rss]5 @RSS [http://example.com/example.rss] 6 6 7 7 Numerous template tweaks to comply with the W3C's Web Content -
trunk/PREREQUISITES
r347 r348 13 13 CGI::Wiki::Plugin::Locator::UK (version 0.06 or later) 14 14 CGI::Wiki::Plugin::RSS::ModWiki (version 0.02 or later) 15 CGI::Wiki::Plugin::RSS::Reader 15 CGI::Wiki::Plugin::RSS::Reader (version 1.2 or later) 16 16 Config::Tiny 17 17 Data::Dumper -
trunk/lib/OpenGuides/Utils.pm
r347 r348 113 113 return qq(<a href="$script_name?action=index;index_type=) . uri_escape(lc($_[0])) . qq(;index_value=) . uri_escape($_[1]) . qq(">$link_title</a>); 114 114 }, 115 qr/\@RSS _FEED\s+\[(.*?)\]/ => sub {116 # Get the URL. It's already been formatted into a117 # 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; 121 121 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; 125 125 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; 128 128 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 } 139 139 ); 140 140
