From 6fefae0f693ec3e31bbb0a8aee02e8ec4db596bb Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Wed, 11 Aug 2004 01:35:17 +0000 Subject: [PATCH] With escaped HTML output. --- modules/atom.pl | 60 ++++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/modules/atom.pl b/modules/atom.pl index 36536cc1..6390e4cf 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.2 2004/08/11 00:30:45 as Exp $

'; +$ModulesDescription .= '

$Id: atom.pl,v 1.3 2004/08/11 01:35:17 as Exp $

'; $Action{atom} = \&DoAtom; @@ -38,26 +38,26 @@ sub AtomTag { sub GetRcAtom { # from http://www.ietf.org/internet-drafts/draft-ietf-atompub-format-01.txt - my $result = < EOT - $result .= AtomTag('title', $SiteName); - $result .= "\n"; - $result .= AtomTag('author', "$RssPublisher") + print AtomTag('title', $SiteName); + print "\n"; + print AtomTag('author', "$RssPublisher") if $RssPublisher; - $result .= AtomTag('contributor', "$RssContributor") + print AtomTag('contributor', "$RssContributor") if $RssContributor; - $result .= "Oddmuse\n"; - $result .= AtomTag('copyright', $RssRights) + print "Oddmuse\n"; + print AtomTag('copyright', $RssRights) if $RssRights; - $result .= <
This is an Atom formatted XML site feed. It is intended to be viewed in a Newsreader or syndicated to another site.
EOT - $result .= AtomTag('modified', AtomTime($LastUpdate)); + print AtomTag('modified', AtomTime($LastUpdate)); GetRc(sub {}, sub { my ($pagename, $timestamp, $host, $userName, $summary, $minor, $revision, $languages, $cluster) = @_; @@ -66,20 +66,34 @@ EOT my $author = $userName; $author = $host unless $author; my $link = $ScriptName . ($UsePathInfo ? '/' : '?') . $pagename; - OpenPage($pagename); - my $content = QuoteHtml($Page{text}); # output - $result .= "\n"; - $result .= AtomTag('title', $name); - $result .= AtomTag('link', $link); - $result .= AtomTag('author', "$author"); - $result .= AtomTag('modified', AtomTime($timestamp)); - $result .= AtomTag('issued', AtomTime($timestamp)); - $result .= AtomTag('summary', $summary); - $result .= "$content\n" if $content; - $result .= "\n"; + my $entry = "\n"; + print AtomTag('title', $name); + print AtomTag('link', $link); + print AtomTag('author', "$author"); + print AtomTag('modified', AtomTime($timestamp)); + print AtomTag('issued', AtomTime($timestamp)); + print AtomTag('summary', $summary); + print "\n"; + print AtomPage($pagename); + print "\n\n"; + print "\n"; }, @_); - $result .= "
\n"; - return $result; + 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); }