/[Frey]/branches/no-pager/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 /branches/no-pager/lib/Frey/Pod.pm

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

revision 128 by dpavlin, Mon Jul 14 23:39:56 2008 UTC revision 344 by dpavlin, Sat Nov 15 16:10:45 2008 UTC
# Line 19  has 'class' => ( Line 19  has 'class' => (
19  use File::Slurp;  use File::Slurp;
20  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
21    
22  sub html {  sub request {
23          my ( $self, $req ) = @_;          my ( $self, $req ) = @_;
24          my $f = { $req->params };          my $f = { $req->params };
25          my $class = delete( $f->{class} ) || $self->class;          my $class = delete( $f->{class} ) || $self->class;
# Line 27  sub html { Line 27  sub html {
27  }  }
28    
29  sub markup {  sub markup {
30          warn "## markup ",dump( @_ );          my $self = shift;
31          my ( $self, $class ) = @_;          my $class = $self->class;
         $class ||= $self->class;  
32          use Pod::Simple::HTML;          use Pod::Simple::HTML;
33          my $path = eval { $self->package_path( $class ) };          my $path = eval { $self->class_path( $class ) };
34          return if $@;          if ( $@ ) {
35                    warn $@;
36                    return qq|<div class="error"><code>$@</code></div>|;
37            }
38          my $pod = read_file( $path );          my $pod = read_file( $path );
39          my $converter = Pod::Simple::HTML->new();          my $converter = Pod::Simple::HTML->new();
40          my $body;          my $body;
41          my $my_classes = join('|', $self->classes);          my $my_classes = join('|', $self->classes);
         warn "my_classes: $my_classes";  
42          $converter->output_string( \$body );          $converter->output_string( \$body );
43          $converter->parse_string_document($pod);          $converter->parse_string_document($pod);
44          $body =~ s{.*?<body [^>]+>}{}s;          $body =~ s{.*?<body [^>]+>}{}s;
45          $body =~ s{</body>\s*</html>\s*$}{};          $body =~ s{</body>\s*</html>\s*$}{};
46          $body =~ s{<a href="http://search\.cpan\.org/perldoc\?($my_classes)"([^>]*)>}{<a href="/pod/$1"$2>}g;          $body =~ s!%3A%3A!::!g;
47            $body =~ s{<a href="http://search\.cpan\.org/perldoc\?($my_classes)"([^>]*)>}{<a href="/$1"$2>}g;
48            $body =~ s{<a href="http://(search\.cpan\.org)/([^"]+)"([^>]*)>}{<a target="$1" href="http://$1/$2"$3>}g;
49          $body =~ s!</li>\n\t<ul>!<ul>!;          $body =~ s!</li>\n\t<ul>!<ul>!;
50          $body =~ s!</ul>!</ul></li>!;          $body =~ s!</ul>!</ul></li>!;
51          $body =~ s!<p></p>!!;          $body =~ s!<p></p>!!;

Legend:
Removed from v.128  
changed lines
  Added in v.344

  ViewVC Help
Powered by ViewVC 1.1.26