From ba7a465caa80e35722de2e702d73c6f5df19eccc Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Mon, 16 Aug 2004 01:24:38 +0000 Subject: [PATCH] (AtomTime): Fix format. (AtomTag): Add escaped parameter. (GetRcAtom): Fix person entities, don't call AtomPage anymore. (AtomPage): Deleted. --- modules/atom.pl | 59 +++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/modules/atom.pl b/modules/atom.pl index 2907dbe9..635d1f25 100644 --- a/modules/atom.pl +++ b/modules/atom.pl @@ -16,7 +16,7 @@ # 59 Temple Place, Suite 330 # Boston, MA 02111-1307 USA -$ModulesDescription .= '

$Id: atom.pl,v 1.4 2004/08/11 10:55:20 as Exp $

'; +$ModulesDescription .= '

$Id: atom.pl,v 1.5 2004/08/16 01:24:38 as Exp $

'; $Action{atom} = \&DoAtom; @@ -27,13 +27,18 @@ sub DoAtom { sub AtomTime { my ($sec, $min, $hour, $mday, $mon, $year) = gmtime(shift); - return sprintf( "%4d-%02d-%02dT%02d:%02d:%02d+00:00 UTC", - $year+1900, $mon+1, $mday, $hour, $min, $sec); + return sprintf( "%4d-%02d-%02dT%02d:%02dZ", + $year+1900, $mon+1, $mday, $hour, $min); } sub AtomTag { - my ($tag, $value) = @_; - return "<$tag>$value\n" if $value; + my ($tag, $value, $escaped) = @_; + return '' unless $value; + if ($escaped) { + return "<$tag mode=\"escaped\">$value\n"; + } else { + return "<$tag>$value\n"; + } } sub GetRcAtom { @@ -45,15 +50,12 @@ sub GetRcAtom { EOT my $title = $SiteName; my $link = $ScriptName; - print AtomTag('title', $title); - print "\n"; - print AtomTag('author', "$RssPublisher") - if $RssPublisher; - print AtomTag('contributor', "$RssContributor") - if $RssContributor; + print AtomTag('title', QuoteHtml($title), 1); + print "\n"; + print AtomTag('author', AtomTag('name', $RssPublisher)) if $RssPublisher; + print AtomTag('contributor', AtomTag('name', $RssContributor)) if $RssContributor; print "Oddmuse\n"; - print AtomTag('copyright', $RssRights) - if $RssRights; + print AtomTag('copyright', QuoteHtml($RssRights), 1) if $RssRights; print <
This is an Atom formatted XML site feed. It is intended to be viewed in a Newsreader or syndicated to another site.
@@ -70,32 +72,21 @@ EOT $author = $host unless $author; # output print "\n", - AtomTag('title', $title), - "\n", - AtomTag('author', "$author"), + AtomTag('title', QuoteHtml($title), 1), + "\n", + AtomTag('author', AtomTag('name', $author, 1)), AtomTag('modified', AtomTime($timestamp)), AtomTag('issued', AtomTime($timestamp)), - AtomTag('summary', $summary), - "\n", - AtomPage($pagename), - "\n\n", + AtomTag('summary', QuoteHtml($summary), 1); + print '', "\n", + '
', "\n"; + OpenPage($pagename); + PrintPageDiff(); + PrintPageHtml(); + print "\n\n", "\n"; }, @_); print "\n"; return ''; } - -sub AtomPage { - my $id = shift; - my $result = ''; - local *STDOUT; - open(STDOUT, '>', \$result) or die "Can't open memory file: $!"; - OpenPage($id); - if ($Page{blocks} && $Page{flags}) { - PrintCache(); - } else { - PrintWikiToHTML($Page{text}, 1); # save cache, current revision, no main lock - } - return QuoteHtml($result); -}