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.5 by root, Wed Apr 18 17:32:07 2007 UTC vs.
Revision 1.12 by root, Sat Aug 18 17:33:53 2007 UTC

85 85
86sub view_textblock { 86sub view_textblock {
87 push @result, { 87 push @result, {
88 indent => $indent * 16, 88 indent => $indent * 16,
89 level => $level, 89 level => $level,
90 markup => "$_[1]\n", 90 markup => flatten $_[1],
91 }; 91 };
92 () 92 ()
93} 93}
94 94
95sub view_head1 { 95sub view_head1 {
183 183
184sub load_pod($) { 184sub load_pod($) {
185 my ($path) = @_; 185 my ($path) = @_;
186 186
187 Coro::Storable::thaw cf::cache "cf::pod::as_paragraphs/$path" => [$path], 187 Coro::Storable::thaw cf::cache "cf::pod::as_paragraphs/$path" => [$path],
188 1 => sub { 188 2 => sub {
189 my ($src) = @_; 189 my ($src) = @_;
190
190 cf::fork_call { 191 cf::fork_call {
191 my $pod = $src->[0]; 192 my $pod = $src->[0];
192 utf8::decode $pod; 193 utf8::decode $pod;
193 Coro::Storable::freeze pom_as_paragraphs +(Pod::POM->new->parse_text ($pod)) 194 Coro::Storable::blocking_nfreeze pom_as_paragraphs +(Pod::POM->new->parse_text ($pod))
194 } 195 }
195 }; 196 };
196} 197}
197 198
199# format as cfpod-style text
200sub as_cfpod($) {
201 my ($pars) = @_;
202
203 my $res;
204
205 for my $par (@$pars) {
206 if ($par->{type} =~ /^head\d+$/) {
207 $res .= "B<$par->{markup}>\n\n";
208 } elsif ($par->{type} eq "verbatim") {
209 $res .= "\n$par->{markup}\n\n";
210 } elsif ($par->{type} eq "item") {
211 $res .= "\n* I<$par->{markup}>\n\n";
212 } else {
213 $res .= "$par->{markup}\n\n";
214 }
215 }
216
217 $res
218}
219
1981; 2201;
199 221

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines