line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::HikiDoc::Plugin::syntaxhighlighter; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
5
|
1
|
|
|
1
|
|
3
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
328
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
*Text::HikiDoc::_parse_pre = sub { |
8
|
5
|
|
|
5
|
|
5
|
my $self = shift; |
9
|
5
|
|
50
|
|
|
8
|
my $string = shift || ''; |
10
|
|
|
|
|
|
|
|
11
|
5
|
50
|
|
|
|
9
|
return '' unless $string; |
12
|
|
|
|
|
|
|
|
13
|
5
|
|
|
|
|
3
|
my $MULTI_PRE_OPEN_RE = '<<<'; |
14
|
5
|
|
|
|
|
3
|
my $MULTI_PRE_CLOSE_RE = '>>>'; |
15
|
5
|
|
|
|
|
5
|
my $PRE_RE = "^[ \t]"; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# pre |
18
|
5
|
|
|
|
|
34
|
$string =~ s|^$MULTI_PRE_OPEN_RE$(.*?)^$MULTI_PRE_CLOSE_RE$|"\n".$self->_store_block(''.$self->_restore_pre($1).' ')."\n\n"|esgm; |
|
1
|
|
|
|
|
3
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# aa |
21
|
5
|
|
|
|
|
31
|
$string =~ s|^$MULTI_PRE_OPEN_RE[ \t]*[aA]{2}$(.*?)^$MULTI_PRE_CLOSE_RE$|"\n".$self->_store_block(''.$1.' ')."\n\n"|esgm; |
|
1
|
|
|
|
|
4
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# raw |
24
|
|
|
|
|
|
|
my $c = sub { |
25
|
1
|
|
|
1
|
|
2
|
my $str = shift; |
26
|
1
|
|
|
|
|
3
|
$str =~ s/</
|
27
|
1
|
|
|
|
|
2
|
$str =~ s/>/>/g; |
28
|
1
|
|
|
|
|
1
|
$str =~ s/&/&/g; |
29
|
1
|
|
|
|
|
4
|
return $str; |
30
|
5
|
|
|
|
|
15
|
}; |
31
|
5
|
|
|
|
|
27
|
$string =~ s|^$MULTI_PRE_OPEN_RE[ \t]*[rR][aA][wW]$(.*?)^$MULTI_PRE_CLOSE_RE$|"\n".$c->($1)."\n\n"|esgm; |
|
1
|
|
|
|
|
2
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# syntaxhighlight |
34
|
5
|
|
|
|
|
32
|
$string =~ s|^$MULTI_PRE_OPEN_RE[ \t]*(\w*)$(.*?)^$MULTI_PRE_CLOSE_RE$|"\n".$self->_store_block(''.$2.' ')."\n\n"|esgm; |
|
2
|
|
|
|
|
11
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$c = sub { |
37
|
0
|
|
|
0
|
|
0
|
my $string = shift; |
38
|
0
|
|
|
|
|
0
|
my $regexp = shift; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
0
|
chomp $string; |
41
|
0
|
|
|
|
|
0
|
$string =~ s|$regexp||gm; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
0
|
return $string; |
44
|
5
|
|
|
|
|
12
|
}; |
45
|
5
|
|
|
|
|
32
|
$string =~ s|((?:$PRE_RE.*\n?)+)|"\n".$self->_store_block("\n".$self->_restore_pre($c->($1,$PRE_RE))."\n ")."\n\n"|egm; |
|
0
|
|
|
|
|
0
|
|
46
|
5
|
|
|
|
|
4
|
$c = undef; |
47
|
|
|
|
|
|
|
|
48
|
5
|
|
|
|
|
59
|
return $string; |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |