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.6 by root, Wed Apr 18 17:57:24 2007 UTC vs.
Revision 1.9 by root, Tue Jul 3 06:07:07 2007 UTC

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 cf::fork_call { 190 cf::fork_call {
191 my $pod = $src->[0]; 191 my $pod = $src->[0];
192 utf8::decode $pod; 192 utf8::decode $pod;
193 Coro::Storable::freeze pom_as_paragraphs +(Pod::POM->new->parse_text ($pod)) 193 Coro::Storable::freeze pom_as_paragraphs +(Pod::POM->new->parse_text ($pod))
194 } 194 }
195 }; 195 };
196} 196}
197 197
198# format as cfpod-style text
198sub as_text($) { 199sub as_text($) {
199 my ($pars) = @_; 200 my ($pars) = @_;
200 201
201 my $res; 202 my $res;
202 203
203 for my $par (@$pars) { 204 for my $par (@$pars) {
204 if ($par->{type} =~ /^head\d+$/) { 205 if ($par->{type} =~ /^head\d+$/) {
205 $res .= "$par->{markup}\n\n"; 206 $res .= "B<$par->{markup}>\n\n";
206 } elsif ($par->{type} eq "verbatim") { 207 } elsif ($par->{type} eq "verbatim") {
207 $res .= "\n$par->{markup}\n\n"; 208 $res .= "\n$par->{markup}\n\n";
208 } elsif ($par->{type} eq "item") { 209 } elsif ($par->{type} eq "item") {
209 $res .= "\n* $par->{markup}\n\n"; 210 $res .= "\n* I<$par->{markup}>\n\n";
210 } else { 211 } else {
211 $res .= "$par->{markup}\n"; 212 $res .= "$par->{markup}\n\n";
212 } 213 }
213 } 214 }
214 215
215 $res =~ s/\n\n+/\n/g;
216
217 $res 216 $res
218} 217}
219 218
2201; 2191;
221 220

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines