--- deliantra/server/lib/cf/pod.pm 2007/04/18 17:32:07 1.5 +++ deliantra/server/lib/cf/pod.pm 2007/08/18 17:33:53 1.12 @@ -87,7 +87,7 @@ push @result, { indent => $indent * 16, level => $level, - markup => "$_[1]\n", + markup => flatten $_[1], }; () } @@ -185,15 +185,37 @@ my ($path) = @_; Coro::Storable::thaw cf::cache "cf::pod::as_paragraphs/$path" => [$path], - 1 => sub { + 2 => sub { my ($src) = @_; + cf::fork_call { my $pod = $src->[0]; utf8::decode $pod; - Coro::Storable::freeze pom_as_paragraphs +(Pod::POM->new->parse_text ($pod)) + Coro::Storable::blocking_nfreeze pom_as_paragraphs +(Pod::POM->new->parse_text ($pod)) } }; } +# format as cfpod-style text +sub as_cfpod($) { + my ($pars) = @_; + + my $res; + + for my $par (@$pars) { + if ($par->{type} =~ /^head\d+$/) { + $res .= "B<$par->{markup}>\n\n"; + } elsif ($par->{type} eq "verbatim") { + $res .= "\n$par->{markup}\n\n"; + } elsif ($par->{type} eq "item") { + $res .= "\n* I<$par->{markup}>\n\n"; + } else { + $res .= "$par->{markup}\n\n"; + } + } + + $res +} + 1;