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 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 |
"<?xml version='1.0' encoding='utf-8'?>\n" |
57 |
. "<rss version='2.0'>\n" |
58 |
. $item->content->present ($self) |
59 |
. "</rss>\n" |
60 |
} |
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 |
} |