ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/www/generate
Revision: 1.27
Committed: Mon Apr 26 13:33:42 2010 UTC (14 years, 2 months ago) by root
Branch: MAIN
Changes since 1.26: +2 -2 lines
Log Message:
*** empty log message ***

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.27 system "rsync -avP src/. html/. --exclude CVS";
29 root 1.24
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 elmex 1.26 package PodHTML;
45    
46     use strict;
47     use warnings;
48     use utf8;
49    
50 root 1.27 my $rcsid = '$Id: generate,v 1.26 2010-04-26 13:00:54 elmex Exp $';
51 elmex 1.26
52     use base "Pod::POM::View";
53    
54     our $subdir;
55     our $dir;
56     our $menu;
57    
58     sub view_pod {
59     my ($self, $item) = @_;
60     $item->content->present ($self)
61     }
62    
63     sub view_head1 {
64     my ($self, $item) = @_;
65     $item->content->present ($self)
66     }
67    
68     sub view_head2 {
69     my ($self, $item) = @_;
70     "<p><em><span class=\"date\">", $item->title, "</span> ", $item->content->present ($self), "</em></p>"
71     }
72    
73     sub view_textblock {
74     my ($self, $item) = @_;
75     $item, "<br />"
76     }
77    
78     sub view_seq_bold {
79     my ($self, $item) = @_;
80     "<b>$item</b>"
81     }
82    
83     sub view_seq_file {
84     my ($self, $item) = @_;
85     "<tt>$item</tt>"
86     }
87    
88     sub view_seq_link {
89     my ($self, $item) = @_;
90     my ($name, $href) = split /\|/, $item, 2;
91     "<a href=\"$href\">$name</a>"
92     }
93    
94    
95 pippijn 1.6 package PodRSS;
96    
97     use strict;
98     use warnings;
99     use utf8;
100    
101     use base "Pod::POM::View";
102    
103     our %metadata;
104    
105     sub view_pod {
106     my ($self, $item) = @_;
107 pippijn 1.18 "<?xml version='1.0' encoding='utf-8'?>\n"
108     . "<rss version='2.0'>\n"
109 pippijn 1.17 . $item->content->present ($self)
110     . "</rss>\n"
111 pippijn 1.6 }
112    
113     sub view_head1 {
114     my ($self, $item) = @_;
115     my $title = $item->title->present ($self);
116     " <channel>\n",
117     " <link>$metadata{link}</link>\n",
118     " <language>$metadata{language}</language>\n",
119     " <title>$title</title>\n",
120     $item->content->present ($self),
121     " </channel>\n"
122     }
123    
124     sub view_head2 {
125     my ($self, $item) = @_;
126     my $title = $item->title->present ($self);
127     " <item>\n",
128     " <title>$title</title>\n",
129     $item->content->present ($self),
130     " </item>\n"
131     }
132    
133     sub view_textblock {
134     my ($self, $item) = @_;
135     " <description><![CDATA[$item]]></description>\n"
136     }