| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Text::Github; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Mojolicious::Plugin::LinkEmbedder::Link::Text::Github - github.com link |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
This class inherit from L. |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
608
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Text::HTML'; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
6
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head2 provider_name |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
|
|
0
|
1
|
|
sub provider_name {'Github'} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _learn_from_dom { |
|
24
|
0
|
|
|
0
|
|
|
my ($self, $dom) = @_; |
|
25
|
0
|
|
|
|
|
|
my $e; |
|
26
|
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
$self->SUPER::_learn_from_dom($dom); |
|
28
|
0
|
0
|
|
|
|
|
$self->title($e->text) if $e = $dom->at('title'); |
|
29
|
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
for my $e ($dom->find('#readme p')->each) { |
|
31
|
0
|
|
0
|
|
|
|
my $text = $e->text || ''; |
|
32
|
0
|
0
|
|
|
|
|
$text =~ /\w/ or next; |
|
33
|
0
|
|
|
|
|
|
$self->title($self->description); |
|
34
|
0
|
|
|
|
|
|
$self->description($text); |
|
35
|
0
|
|
|
|
|
|
last; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
if ($self->url->path =~ m!/commit!) { |
|
|
|
0
|
|
|
|
|
|
|
39
|
0
|
0
|
0
|
|
|
|
$self->image($e->{src}) if $e = $dom->at('img.avatar') and $e->{src}; |
|
40
|
0
|
0
|
|
|
|
|
$self->title($e->all_text) if $e = $dom->at('.commit-title'); |
|
41
|
0
|
0
|
|
|
|
|
$self->description($e->all_text) if $e = $dom->at('.commit-meta .authorship'); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
elsif ($self->url->path =~ m!/(?:issue|pull)!) { |
|
44
|
0
|
0
|
0
|
|
|
|
$self->image($e->{src}) if $e = $dom->at('img.timeline-comment-avatar') and $e->{src}; |
|
45
|
0
|
0
|
|
|
|
|
$self->title($e->text) if $e = $dom->at('.js-issue-title'); |
|
46
|
0
|
0
|
|
|
|
|
$self->description($e->all_text) if $e = eval { $dom->at('#partial-discussion-header a.author')->parent }; |
|
|
0
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 AUTHOR |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Jan Henning Thorsen |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |