| 1 | package Swim::Plugin::badge; | ||||||||||
| 2 | 2 | our $VERSION = '0.1.8'; | |||||||||
| 3 | |||||||||||
| 4 | package Swim::Pod; | ||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | sub phrase_func_badge { | ||||||||
|
Subroutine
phrase_func_badge: called CC=6 SCAR=18.5
Pod
undocumented
| |||||||||||
| 7 | 1 | my ($self, $args) = @_; | |||||||||
| 8 | 1 | my @args = split / +/, $args; | |||||||||
| 9 | 1 | ▶ | $args = pop @args or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 10 | 1 | ▶ | return unless @args; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | 1 | ▶ | return unless $args =~ /^(\S+)\/(\S+)$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | 1 | my $out = "=for html\n"; | |||||||||
| 13 | 1 | for my $type (@args) { | |||||||||
| 14 | 2 | my $method = "_badge_$type"; | |||||||||
| 15 | 2 | ▶ | if ($self->can($method)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 2 | $out .= $self->$method($1, $2) . "\n"; | |||||||||
| 17 | } | ||||||||||
| 18 | } | ||||||||||
| 19 | 1 | return "$out\n"; | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 1 | ▶ | sub phrase_func_badge_travis { | ||||||||
|
Subroutine
phrase_func_badge_travis: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 23 | 1 | my ($self, $args) = @_; | |||||||||
| 24 | 1 | ▶ | return unless $args =~ /^(\S+)\/(\S+)$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 1 | sprintf "=for html\n%s\n\n", $self->_badge_travis($1, $2); | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 1 | ▶ | sub phrase_func_badge_coveralls { | ||||||||
|
Subroutine
phrase_func_badge_coveralls: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 29 | 1 | my ($self, $args) = @_; | |||||||||
| 30 | 1 | ▶ | return unless $args =~ /^(\S+)\/(\S+)$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 1 | sprintf "=for html\n%s\n\n", $self->_badge_coveralls($1, $2); | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 2 | ▶ | sub _badge_travis { | ||||||||
|
Subroutine
_badge_travis: called CC=1 SCAR=0.0
| |||||||||||
| 35 | 2 | my ($self, $owner, $repo) = @_; | |||||||||
| 36 | 2 | qq{<a href="https://travis-ci.org/$owner/$repo"><img src="https://travis-ci.org/$owner/$repo.png" alt="$repo"></a>}; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 2 | ▶ | sub _badge_coveralls { | ||||||||
|
Subroutine
_badge_coveralls: called CC=1 SCAR=0.0
| |||||||||||
| 40 | 2 | my ($self, $owner, $repo) = @_; | |||||||||
| 41 | 2 | qq{<a href="https://coveralls.io/r/$owner/$repo?branch=master"><img src="https://coveralls.io/repos/$owner/$repo/badge.png" alt="$repo"></a>}; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | package Swim::Markdown; | ||||||||||
| 45 | |||||||||||
| 46 | 1 | ▶ | sub phrase_func_badge { | ||||||||
|
Subroutine
phrase_func_badge: called CC=6 SCAR=18.4
Pod
undocumented
| |||||||||||
| 47 | 1 | my ($self, $args) = @_; | |||||||||
| 48 | 1 | my @args = split / +/, $args; | |||||||||
| 49 | 1 | ▶ | $args = pop @args or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | 1 | ▶ | return unless @args; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | 1 | ▶ | return unless $args =~ /^(\S+)\/(\S+)$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | 1 | my $out = ""; | |||||||||
| 53 | 1 | for my $type (@args) { | |||||||||
| 54 | 2 | my $method = "_badge_$type"; | |||||||||
| 55 | 2 | ▶ | if ($self->can($method)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 2 | $out .= $self->$method($1, $2) . "\n"; | |||||||||
| 57 | } | ||||||||||
| 58 | } | ||||||||||
| 59 | 1 | chomp $out; | |||||||||
| 60 | 1 | return $out; | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | 1 | ▶ | sub phrase_func_badge_travis { | ||||||||
|
Subroutine
phrase_func_badge_travis: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 64 | 1 | my ($self, $args) = @_; | |||||||||
| 65 | 1 | ▶ | return unless $args =~ /^(\S+)\/(\S+)$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | 1 | $self->_badge_travis($1, $2); | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | 1 | ▶ | sub phrase_func_badge_coveralls { | ||||||||
|
Subroutine
phrase_func_badge_coveralls: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 70 | 1 | my ($self, $args) = @_; | |||||||||
| 71 | 1 | ▶ | return unless $args =~ /^(\S+)\/(\S+)$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 72 | 1 | $self->_badge_coveralls($1, $2); | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | 2 | ▶ | sub _badge_travis { | ||||||||
|
Subroutine
_badge_travis: called CC=1 SCAR=0.0
| |||||||||||
| 76 | 2 | my ($self, $owner, $repo) = @_; | |||||||||
| 77 | 2 | qq{[](https://travis-ci.org/$owner/$repo)}; | |||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | 2 | ▶ | sub _badge_coveralls { | ||||||||
|
Subroutine
_badge_coveralls: called CC=1 SCAR=0.0
| |||||||||||
| 81 | 2 | my ($self, $owner, $repo) = @_; | |||||||||
| 82 | 2 | qq{[](https://coveralls.io/r/$owner/$repo?branch=master)}; | |||||||||
| 83 | } | ||||||||||
| 84 | |||||||||||
| 85 | 2 | 1; | |||||||||