line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Text::Github; |
2
|
1
|
|
|
1
|
|
431
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link::Text::HTML'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
3
|
|
|
|
|
|
|
|
4
|
0
|
|
|
0
|
1
|
|
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; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=encoding utf8 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Mojolicious::Plugin::LinkEmbedder::Link::Text::Github - github.com link |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This class inherit from L. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 provider_name |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 AUTHOR |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Jan Henning Thorsen |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |