From 2f779656fcc4a1a133045d2bd9fe33834a85a2dd Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Sat, 28 Mar 2015 18:28:33 +0200 Subject: [PATCH] atom.pl ready for use strict --- modules/atom.pl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/atom.pl b/modules/atom.pl index 33064bf3..c0fe750a 100644 --- a/modules/atom.pl +++ b/modules/atom.pl @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# use strict; # TODO fix problem with %excluded (108) and $id (118) +use strict; use XML::Atom::Entry; use XML::Atom::Link; @@ -21,7 +21,7 @@ use XML::Atom::Person; AddModuleDescription('atom.pl', 'Atom Extension'); -use vars qw($q %Page %Action $CommentsPrefix $ScriptName $SiteName $MaxPost $UseDiff $NewText $DeletedPage @MyInitVariables @MyMacros $FS $BannedContent $RssStyleSheet $RssRights $RssLicense $RssImageUrl $RCName @UploadTypes $UploadAllowed $UsePathInfo $SiteDescription $LastUpdate $InterWikiMoniker); +use vars qw($q %Page %Action $CommentsPrefix $ScriptName $SiteName $MaxPost $UseDiff $NewText $DeletedPage @MyInitVariables @MyMacros $FS $BannedContent $RssStyleSheet $RssRights $RssLicense $RssImageUrl $RssExclude $RCName @UploadTypes $UploadAllowed $UsePathInfo $SiteDescription $LastUpdate $InterWikiMoniker); push(@MyInitVariables, \&AtomInit); @@ -102,6 +102,14 @@ sub GetRcAtom { (ref $RssLicense eq 'ARRAY' ? @$RssLicense : $RssLicense)); $feed .= AtomTag('wiki:interwiki', $InterWikiMoniker) if $InterWikiMoniker; $feed .= AtomTag('logo', $RssImageUrl) if $RssImageUrl; + my %excluded = (); + if (GetParam("exclude", 1)) { + foreach (split(/\n/, GetPageContent($RssExclude))) { + if (/^ ([^ ]+)[ \t]*$/) { # only read lines with one word after one space + $excluded{$1} = 1; + } + } + } # Now call GetRc with some blocks of code as parameters: ProcessRcLines(sub {}, sub { my ($pagename, $timestamp, $host, $username, $summary, $minor, $revision, $languages, $cluster) = @_; @@ -115,7 +123,7 @@ sub GetRcAtom { . (GetParam('all', $cluster) ? QuoteHtml($ScriptName) . "?" . GetPageParameters('browse', $pagename, $revision, $cluster) : $url . UrlEncode($pagename)) . qq{"/>\n}; - $feed .= AtomLink("$ScriptName/atom/wiki/$id"); + $feed .= AtomLink("$ScriptName/atom/wiki/$pagename"); $feed .= AtomTag('summary', QuoteHtml($summary)); $feed .= qq{\n
\n} . PageHtml($pagename, 50*1024,$q->div(T('This page is too big to send over RSS.')))