File Coverage

blib/lib/Pod/Markdown/Github.pm
Criterion Covered Total %
statement 18 18 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 25 26 96.1


line stmt bran cond sub pod time code
1             package Pod::Markdown::Github;
2              
3 1     1   673 use strict;
  1         1  
  1         30  
4 1     1   4 use warnings;
  1         1  
  1         21  
5 1     1   726 use parent 'Pod::Markdown';
  1         286  
  1         4  
6              
7             our $VERSION = '0.01';
8              
9             sub syntax {
10 2     2 0 4 my ( $self, $paragraph ) = @_;
11 2 100       27 return ( $paragraph =~ /(sub|my|use|shift|\$self|\=\>|\$_|\@_)/ )
12             ? 'perl'
13             : '';
14             }
15              
16             sub _indent_verbatim {
17 2     2   6408 my ( $self, $paragraph ) = @_;
18 2         5 $DB::single = 1;
19 2         11 $paragraph = $self->SUPER::_indent_verbatim($paragraph);
20              
21             # Remove the leading 4 spaces because we'll escape via ```language
22 2         48 $paragraph = join "\n", map { s/^\s{4}//; $_ } split /\n/, $paragraph;
  5         13  
  5         12  
23              
24             # Enclose the paragraph in ``` and specify the language
25 2         9 return sprintf( "```%s\n%s\n```", $self->syntax($paragraph), $paragraph );
26             }
27              
28             1;
29              
30             __END__