ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/www/generate
Revision: 1.25
Committed: Mon Apr 26 12:58:35 2010 UTC (14 years, 2 months ago) by elmex
Branch: MAIN
Changes since 1.24: +2 -137 lines
Log Message:
many further changes.

File Contents

# User Rev Content
1 elmex 1.21 #!/opt/perl/bin/perl
2 pippijn 1.1
3 root 1.24 use common::sense;
4 pippijn 1.1
5 pippijn 1.5 use Pod::POM;
6 pippijn 1.1 use Template;
7     use YAML;
8    
9 pippijn 1.8 my $parser = new Pod::POM meta => 1;
10    
11 pippijn 1.14 my ($pom, $html);
12    
13 root 1.19 $pom = $parser->parse ("src/news.pod")
14 pippijn 1.14 or die $parser->error;
15     $html = $pom->present ("PodHTML");
16     $html =~ s/\[/</g;
17     $html =~ s/\]/>/g;
18 root 1.24 open FH, ">", "src/news.html.inc" or die "src/news.html.inc: $!";
19 pippijn 1.14 print FH $html;
20     close FH;
21    
22     %PodRSS::metadata = %{ $pom->metadata };
23     $html = $pom->present ("PodRSS");
24 elmex 1.25 open FH, ">", "src/news.rss" or die "src/news.rss: $!";
25 pippijn 1.14 print FH $html;
26     close FH;
27    
28 root 1.24 system "rsync -avP src/. html/. --del --delete-excluded --exclude CVS";
29    
30 pippijn 1.5 =head1 AUTHOR
31    
32 elmex 1.25 Copyright © 2010 The Deliantra Team
33 pippijn 1.5 Copyright © 2007 Pippijn van Steenhoven
34    
35     =head1 LICENSE
36    
37     This library is free software, you can redistribute it and/or modify
38     it under the terms of the GNU General Public License.
39    
40     =cut
41    
42 pippijn 1.6 1;
43    
44     package PodRSS;
45    
46     use strict;
47     use warnings;
48     use utf8;
49    
50     use base "Pod::POM::View";
51    
52     our %metadata;
53    
54     sub view_pod {
55     my ($self, $item) = @_;
56 pippijn 1.18 "<?xml version='1.0' encoding='utf-8'?>\n"
57     . "<rss version='2.0'>\n"
58 pippijn 1.17 . $item->content->present ($self)
59     . "</rss>\n"
60 pippijn 1.6 }
61    
62     sub view_head1 {
63     my ($self, $item) = @_;
64     my $title = $item->title->present ($self);
65     " <channel>\n",
66     " <link>$metadata{link}</link>\n",
67     " <language>$metadata{language}</language>\n",
68     " <title>$title</title>\n",
69     $item->content->present ($self),
70     " </channel>\n"
71     }
72    
73     sub view_head2 {
74     my ($self, $item) = @_;
75     my $title = $item->title->present ($self);
76     " <item>\n",
77     " <title>$title</title>\n",
78     $item->content->present ($self),
79     " </item>\n"
80     }
81    
82     sub view_textblock {
83     my ($self, $item) = @_;
84     " <description><![CDATA[$item]]></description>\n"
85     }