| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Text::Github; |
|
2
|
1
|
|
|
1
|
|
2157
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Text::HTML'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
0
|
|
|
0
|
0
|
|
sub provider_name {'Github'} |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub _learn_from_dom { |
|
7
|
0
|
|
|
0
|
|
|
my ($self, $dom) = @_; |
|
8
|
0
|
|
|
|
|
|
my $e; |
|
9
|
|
|
|
|
|
|
|
|
10
|
0
|
|
|
|
|
|
$self->SUPER::_learn_from_dom($dom); |
|
11
|
0
|
0
|
|
|
|
|
$self->title($e->text) if $e = $dom->at('title'); |
|
12
|
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
for my $e ($dom->find('#readme p')->each) { |
|
14
|
0
|
|
0
|
|
|
|
my $text = $e->text || ''; |
|
15
|
0
|
0
|
|
|
|
|
$text =~ /\w/ or next; |
|
16
|
0
|
|
|
|
|
|
$self->title($self->description); |
|
17
|
0
|
|
|
|
|
|
$self->description($text); |
|
18
|
0
|
|
|
|
|
|
last; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
if ($self->url->path =~ m!/commit!) { |
|
|
|
0
|
|
|
|
|
|
|
22
|
0
|
0
|
0
|
|
|
|
$self->image($e->{src}) if $e = $dom->at('img.avatar') and $e->{src}; |
|
23
|
0
|
0
|
|
|
|
|
$self->title($e->all_text) if $e = $dom->at('.commit-title'); |
|
24
|
0
|
0
|
|
|
|
|
$self->description($e->all_text) if $e = $dom->at('.commit-author-section'); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
elsif ($self->url->path =~ m!/(?:issue|pull)!) { |
|
27
|
0
|
0
|
0
|
|
|
|
$self->image($e->{src}) if $e = $dom->at('img.timeline-comment-avatar') and $e->{src}; |
|
28
|
0
|
0
|
|
|
|
|
$self->title($e->text) if $e = $dom->at('.js-issue-title'); |
|
29
|
0
|
0
|
|
|
|
|
$self->description($e->all_text) if $e = eval { $dom->at('#partial-discussion-header a.author')->parent }; |
|
|
0
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |