/[Frey]/trunk/lib/Frey/Pod.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/Pod.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 138 by dpavlin, Tue Jul 15 19:10:56 2008 UTC revision 356 by dpavlin, Sun Nov 16 15:49:49 2008 UTC
# Line 18  has 'class' => ( Line 18  has 'class' => (
18    
19  use File::Slurp;  use File::Slurp;
20  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
21    use Pod::Find qw/pod_where/;
22    
23  sub html {  sub request {
24          my ( $self, $req ) = @_;          my ( $self, $req ) = @_;
25          my $f = { $req->params };          my $f = { $req->params };
26          my $class = delete( $f->{class} ) || $self->class;          my $class = delete( $f->{class} ) || $self->class;
# Line 27  sub html { Line 28  sub html {
28  }  }
29    
30  sub markup {  sub markup {
31          my ( $self, $class ) = @_;          my $self = shift;
32          $class ||= $self->class;          my $class = $self->class;
33          use Pod::Simple::HTML;          use Pod::Simple::HTML;
34          my $path = eval { $self->package_path( $class ) };          my $path = pod_where( { -inc => 1 }, $class );
35          return if $@;          return $self->error( "Can't find pod for $class" ) unless $path;
36          my $pod = read_file( $path );          my $pod = read_file( $path );
37          my $converter = Pod::Simple::HTML->new();          my $converter = Pod::Simple::HTML->new();
38          my $body;          my $body;
# Line 41  sub markup { Line 42  sub markup {
42          $body =~ s{.*?<body [^>]+>}{}s;          $body =~ s{.*?<body [^>]+>}{}s;
43          $body =~ s{</body>\s*</html>\s*$}{};          $body =~ s{</body>\s*</html>\s*$}{};
44          $body =~ s!%3A%3A!::!g;          $body =~ s!%3A%3A!::!g;
45          $body =~ s{<a href="http://search\.cpan\.org/perldoc\?($my_classes)"([^>]*)>}{<a href="/~/$1"$2>}g;  #       $body =~ s{<a href="http://search\.cpan\.org/perldoc\?($my_classes)"([^>]*)>}{<a href="/$1"$2>}g;
46            $body =~ s{<a href="http://(search\.cpan\.org/perldoc\?)([^"]+)"([^>]*)>([^<]+)<([^>]+)>}{<a href="/$2"$3>$4<$5><sup><a target="$1" title="CPAN" style="text-decoration: none" href="http://$1/$2"$3>&loz;<$5></sup>}g;
47          $body =~ s!</li>\n\t<ul>!<ul>!;          $body =~ s!</li>\n\t<ul>!<ul>!;
48          $body =~ s!</ul>!</ul></li>!;          $body =~ s!</ul>!</ul></li>!;
49          $body =~ s!<p></p>!!;          $body =~ s!<p></p>!!;

Legend:
Removed from v.138  
changed lines
  Added in v.356

  ViewVC Help
Powered by ViewVC 1.1.26