line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::HikiDoc::Plugin::syntaxhighlighter; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
4
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
5
|
1
|
|
|
1
|
|
3
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
381
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
*Text::HikiDoc::_parse_pre = sub { |
8
|
5
|
|
|
5
|
|
4
|
my $self = shift; |
9
|
5
|
|
50
|
|
|
7
|
my $string = shift || ''; |
10
|
|
|
|
|
|
|
|
11
|
5
|
50
|
|
|
|
8
|
return '' unless $string; |
12
|
|
|
|
|
|
|
|
13
|
5
|
|
|
|
|
5
|
my $MULTI_PRE_OPEN_RE = '<<<'; |
14
|
5
|
|
|
|
|
2
|
my $MULTI_PRE_CLOSE_RE = '>>>'; |
15
|
5
|
|
|
|
|
5
|
my $PRE_RE = "^[ \t]"; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# pre |
18
|
5
|
|
|
|
|
33
|
$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
|
|
|
|
|
32
|
$string =~ s|^$MULTI_PRE_OPEN_RE[ \t]*[aA]{2}$(.*?)^$MULTI_PRE_CLOSE_RE$|"\n".$self->_store_block(''.$1.' ')."\n\n"|esgm; |
|
1
|
|
|
|
|
10
|
|
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
|
|
|
|
|
3
|
return $str; |
30
|
5
|
|
|
|
|
11
|
}; |
31
|
5
|
|
|
|
|
25
|
$string =~ s|^$MULTI_PRE_OPEN_RE[ \t]*[rR][aA][wW]$(.*?)^$MULTI_PRE_CLOSE_RE$|"\n".$c->($1)."\n\n"|esgm; |
|
1
|
|
|
|
|
3
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# syntaxhighlight |
34
|
5
|
|
|
|
|
35
|
$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
|
|
|
|
|
10
|
}; |
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
|
|
|
|
|
17
|
return $string; |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |