ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf/pod.pm
(Generate patch)

Comparing deliantra/server/lib/cf/pod.pm (file contents):
Revision 1.13 by root, Sun Aug 31 09:03:31 2008 UTC vs.
Revision 1.19 by root, Mon Mar 30 13:38:15 2009 UTC

10 10
11use strict; 11use strict;
12 12
13use base "Pod::POM::View"; 13use base "Pod::POM::View";
14 14
15my %E = (
16 "<" => "E<lt>",
17 ">" => "E<gt>",
18);
19
15sub asxml($) { 20sub aspod($) {
16 local $_ = $_[0]; 21 local $_ = $_[0];
17 22
18 s/</E<lt>/g; 23 s/[<>]/$E{$1}/g;
19 s/>/E<gt>/g;
20 24
21 $_ 25 $_
22} 26}
23 27
24sub flatten($) { 28sub flatten($) {
25 local $_ = $_[0]; 29 local $_ = $_[0];
26 30
27 s/<[^>]+>//g;
28 s/^\s+//; 31 s/^\s+//;
29 s/\s+$//; 32 s/\s+$//;
30 s/\s+/ /g; 33 s/\s+/ /g;
31 34
32 $_ 35 $_
33} 36}
34 37
35*view_seq_file = 38*view_seq_file = sub { "C<$_[1]>" };
36*view_seq_code = 39*view_seq_code = sub { "C<$_[1]>" };
37*view_seq_bold = sub { "B<$_[1]>" }; 40*view_seq_bold = sub { "B<$_[1]>" };
38*view_seq_italic = sub { "I<$_[1]>" }; 41*view_seq_italic = sub { "I<$_[1]>" };
42*view_seq_T = sub { "T<$_[1]>" };
43*view_seq_G = sub { "G<$_[1]>" };
39*view_seq_zero = sub { }; 44*view_seq_zero = sub { "Z<>" };
40*view_seq_space = sub { my $text = $_[1]; $text =~ s/ /\xa0/g; $text }; 45*view_seq_space = sub { my $text = $_[1]; $text =~ s/ /\xa0/g; $text };
41*view_seq_index = sub { push @{ $result[-1]{index} }, $_[1]; "" }; 46*view_seq_index = sub { push @{ $result[-1]{index} }, $_[1]; "" };
42 47
43sub view_seq_text { 48sub view_seq_text {
44 my $text = $_[1]; 49 my $text = $_[1];
45 $text =~ s/\s+/ /g; 50 $text =~ s/\s+/ /g;
46 asxml $text 51 aspod $text
47} 52}
48 53
49sub view_seq_link { 54sub view_seq_link {
50 my (undef, $link) = @_; 55 my (undef, $link) = @_;
51 56
52 my $text = $link =~ s/^(.*)\|// ? $1 : $link; 57 my $text = $link =~ s/^(.*)\|// ? $1 : $link;
53 58
54 if ($link =~ /http:/) { 59 if ($link =~ /http:/) {
55 "U<" . (asxml $link) . ">" 60 "U<" . (aspod $link) . ">"
56 } else { 61 } else {
57 () 62 ()
58 } 63 }
59} 64}
60 65
182 187
183sub load_pod($) { 188sub load_pod($) {
184 my ($path) = @_; 189 my ($path) = @_;
185 190
186 Coro::Storable::thaw cf::cache "cf::pod::as_paragraphs/$path" => [$path], 191 Coro::Storable::thaw cf::cache "cf::pod::as_paragraphs/$path" => [$path],
187 3 => sub { 192 7 => sub {
188 my ($src) = @_; 193 my ($src) = @_;
189 194
190 cf::fork_call { 195 cf::fork_call {
191 my $pod = $src->[0]; 196 my $pod = $src->[0];
192 utf8::decode $pod; 197 utf8::decode $pod;
203 208
204 for my $par (@$pars) { 209 for my $par (@$pars) {
205 if ($par->{type} =~ /^head\d+$/) { 210 if ($par->{type} =~ /^head\d+$/) {
206 $res .= "B<$par->{markup}>\n\n"; 211 $res .= "B<$par->{markup}>\n\n";
207 } elsif ($par->{type} eq "verbatim") { 212 } elsif ($par->{type} eq "verbatim") {
208 $res .= "\n$par->{markup}\n\n"; 213 $res .= "$par->{markup}\n\n";
209 } elsif ($par->{type} eq "item") { 214 } elsif ($par->{type} eq "item") {
210 $res .= "\n* I<$par->{markup}>\n\n"; 215 $res .= "* I<$par->{markup}>\n\n";
211 } else { 216 } else {
212 $res .= "$par->{markup}\n\n"; 217 $res .= "$par->{markup}\n\n";
213 } 218 }
214 } 219 }
215 220

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines