--- trunk/lib/Frey/Pod.pm 2008/11/15 16:29:26 346 +++ trunk/lib/Frey/Pod.pm 2008/11/19 15:28:23 455 @@ -18,25 +18,14 @@ use File::Slurp; use Data::Dump qw/dump/; +use Pod::Find qw/pod_where/; -sub request { - my ( $self, $req ) = @_; - my $f = { $req->params }; - my $class = delete( $f->{class} ) || $self->class; - $req->print( $self->page( title => $class, body => $self->markup( $class ) ) ); -} - -sub markup { +sub as_markup { my $self = shift; my $class = $self->class; use Pod::Simple::HTML; - my $path = eval { $self->class_path( $class ) }; - if ( $@ ) { - warn $@; - my $error = $@; - $error =~ s{\s+(\S+)\s+line\s+(\d+)}{ $1 line $2}gsm; - return qq|
$error
|; - } + my $path = pod_where( { -inc => 1 }, $class ); + return $self->error( "Can't find pod for $class" ) unless $path; my $pod = read_file( $path ); my $converter = Pod::Simple::HTML->new(); my $body; @@ -46,13 +35,18 @@ $body =~ s{.*?]+>}{}s; $body =~ s{\s*\s*$}{}; $body =~ s!%3A%3A!::!g; - $body =~ s{]*)>}{}g; - $body =~ s{]*)>}{}g; +# $body =~ s{]*)>}{}g; + $body =~ s{]*)>([^<]+)<([^>]+)>}{$4<$5>◊<$5>}g; $body =~ s!\n\t!; $body =~ s!

!!; $body =~ s!__index__!index!g; - return $body; + return $body unless wantarray; + return { + title => $class, + body => $body, + }; + } 1;