/[Frey]/trunk/lib/Frey/Shell/Grep.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/Shell/Grep.pm

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

revision 716 by dpavlin, Thu Dec 4 17:35:11 2008 UTC revision 792 by dpavlin, Wed Dec 10 15:15:22 2008 UTC
# Line 65  sub { Line 65  sub {
65  });  });
66    
67  sub as_markup {  sub as_markup {
68          my ($self) = @_;          my $self = shift;
69            my $callback = {@_};
70    
71          my $patt = $self->pattern;          my $patt = $self->pattern;
72          $self->title( $patt );          $self->title( $patt );
# Line 91  sub as_markup { Line 92  sub as_markup {
92    
93          foreach my $result ( @{ $self->results_as_data } ) {          foreach my $result ( @{ $self->results_as_data } ) {
94    
95                  warn $self->dump( $result );                  warn $self->dump( $result ) if $self->debug;
96    
97                  my $text = $result->{text} || die "no text";                  my $text = $result->{text} || die "no text";
98    
# Line 101  sub as_markup { Line 102  sub as_markup {
102                          if ( $path ne $last_path ) {                          if ( $path ne $last_path ) {
103                                  $html .= qq|<dt class="p">$path</dt>|;                                  $html .= qq|<dt class="p">$path</dt>|;
104                          }                          }
105                          $text =~ s{(\Q$patt\E)}{<b>$1</b>};                          if ( my $dd = $callback->{dd} ) {
106                          $html .= qq|<dd><a target="editor" href="/editor+$path+$line">$line</a> <code>$text</code>|;                                  $html .= $dd->( $patt, $path, $line, $text );
107                            } else {
108                                    $text =~ s{(\Q$patt\E)}{<b>$1</b>};
109                                    $html .= qq|<dd><a target="editor" href="/editor+$path+$line">$line</a> <code>$text</code>|;
110                            }
111                          $last_path = $path;                          $last_path = $path;
112                  } else {                  } else {
113                          $html .= qq|<dt>$text</dt>|;                          $html .= qq|<dt>$text</dt>|;
# Line 120  sub as_markup { Line 125  sub as_markup {
125                  $html = $self->error( "No results for $patt\n" );                  $html = $self->error( "No results for $patt\n" );
126          }          }
127    
128            $self->add_head(qq|
129                    <link rel="search" type="application/opensearchdescription+xml" title="Frey::Shell::Grep" href="/Frey::OpenSearch/grep_as_markup">
130            |);
131    
132          return $html;          return $html;
133  }  }
134    

Legend:
Removed from v.716  
changed lines
  Added in v.792

  ViewVC Help
Powered by ViewVC 1.1.26