ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/www/generate
Revision: 1.26
Committed: Mon Apr 26 13:00:54 2010 UTC (14 years, 2 months ago) by elmex
Branch: MAIN
Changes since 1.25: +51 -0 lines
Log Message:
fixed generate.

File Contents

# Content
1 #!/opt/perl/bin/perl
2
3 use common::sense;
4
5 use Pod::POM;
6 use Template;
7 use YAML;
8
9 my $parser = new Pod::POM meta => 1;
10
11 my ($pom, $html);
12
13 $pom = $parser->parse ("src/news.pod")
14 or die $parser->error;
15 $html = $pom->present ("PodHTML");
16 $html =~ s/\[/</g;
17 $html =~ s/\]/>/g;
18 open FH, ">", "src/news.html.inc" or die "src/news.html.inc: $!";
19 print FH $html;
20 close FH;
21
22 %PodRSS::metadata = %{ $pom->metadata };
23 $html = $pom->present ("PodRSS");
24 open FH, ">", "src/news.rss" or die "src/news.rss: $!";
25 print FH $html;
26 close FH;
27
28 system "rsync -avP src/. html/. --del --delete-excluded --exclude CVS";
29
30 =head1 AUTHOR
31
32 Copyright © 2010 The Deliantra Team
33 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 1;
43
44 package PodHTML;
45
46 use strict;
47 use warnings;
48 use utf8;
49
50 my $rcsid = '$Id: generate,v 1.24 2010-03-22 20:36:18 root Exp $';
51
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 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 "<?xml version='1.0' encoding='utf-8'?>\n"
108 . "<rss version='2.0'>\n"
109 . $item->content->present ($self)
110 . "</rss>\n"
111 }
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 }